| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

Public Member Functions | Static Public Member Functions | List of all members
Color Class Reference
PDFViewCtrl » shared

Class for processing color-related algorithms such as conversions. More...

## Public Member Functions
| asArray ()
| Convert this Color instance into an array with four channel values R,G,B,A. More...
| clone ()
| Clones an identical object. More...
| isSameAs (other:Color)
| Check if this color is the same as another color instance. More...
| toCMYK ()
| Convert R,G,B values to CMYK representation model. More...
| toHSL ()
| Convert R,G,B values to HSL representation model. More...
| toHSV ()
| Convert into HSV representation model. More...

## Static Public Member Functions
static | fromARGB (argb:number)
| Create Color instance from ARGB values (such as: 0xFFFFFF). More...
static | fromHSLA (h:number, s:number, l:number, a:number)
| Create Color instance using HSL representation model. More...
static | fromRGB (rgb:number)
| Create Color instance from RGB values (such as: 0xFFFFFF). More...
static | fromRGBA (rgb:number, a:number)
| Create Color instance from RGB values (such as: 0xFFFFFF) and separately specified alpha values. More...

## Detailed Description

Class for processing color-related algorithms such as conversions.

Since
  9.0.0

## Member Function Documentation

## ◆ asArray()

Color::asArray | ( |  | ) |
| inline

Convert this Color instance into an array with four channel values R,G,B,A.

Returns
  [number,number,number,number] - An array includes the R, G, B, A channels

Since
  9.0.0

## ◆ clone()

Color::clone | ( |  | ) |
| inline

Clones an identical object.

Returns
  Color -

Since
  9.0.0

## ◆ fromARGB()

static Color::fromARGB | ( |  | argb:number | ) |
| inline static

Create Color instance from ARGB values (such as: 0xFFFFFF).

Parameters

  argb | number - ARGB values, pattern: 0xAARRGGBB.

Returns
  Color -

Since
  9.0.0

## ◆ fromHSLA()

static Color::fromHSLA | ( |  | h:number,
|  |  | s:number,
|  |  | l:number,
|  |  | a:number
| ) |  |
| inline static

Create Color instance using HSL representation model.

Parameters

  h | number - The hue channel, the value is between 0 and 360 (inclusive).
  s | number - The saturation channel, the value is between 0 and 100 (inclusive).
  l | number - The lightness channel, the value is between 0 and 100 (inclusive).
  a | number - The alpha channel, the value is between 0 and 255 (inclusive).

Returns
  Color -

Since
  9.0.0

## ◆ fromRGB()

static Color::fromRGB | ( |  | rgb:number | ) |
| inline static

Create Color instance from RGB values (such as: 0xFFFFFF).

Parameters

  rgb | number - RGB values, pattern: 0xRRGGBB.

Returns
  Color -

Since
  9.0.0

## ◆ fromRGBA()

static Color::fromRGBA | ( |  | rgb:number,
|  |  | a:number
| ) |  |
| inline static

Create Color instance from RGB values (such as: 0xFFFFFF) and separately specified alpha values.

Parameters

  rgb | number - RGB values, pattern: 0xRRGGBB.
  a | number - The alpha channel, the value is between 0 and 255 (inclusive).

Returns
  Color

## ◆ isSameAs()

Color::isSameAs | ( |  | other:Color | ) |
| inline

Check if this color is the same as another color instance.

Parameters

  other | Color - Another Color instance to detected.

Returns
  boolean - true if the same, false otherwise

Since
  9.0.0

## ◆ toCMYK()

Color::toCMYK | ( |  | ) |
| inline

Convert R,G,B values to CMYK representation model.

Returns
  {c:number;m:number;y:number;k:number} - An object with four channel values of C, M, Y, K.

Since
  9.0.0

## ◆ toHSL()

Color::toHSL | ( |  | ) |
| inline

Convert R,G,B values to HSL representation model.

Returns
  {h:number;s:number;l:number} - An object with three channel values of H, S, L.

Since
  9.0.0

## ◆ toHSV()

Color::toHSV | ( |  | ) |
| inline

Convert into HSV representation model.

Returns
  {h:number;s:number;v:number} -

Since
  9.0.0

@2025 Foxit Software Incorporated. All rights reserved.