Class: Color
Common.Color()
Represents digital ink color in RGBA format
Constructor
new Color()
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
red | int | Red component, value between 0 and 255 | |
green | int | Green component, value between 0 and 255 | |
blue | int | Blue component, value between 0 and 255 | |
alpha | float | <optional> | Alpha (Opacity) component, value between 0 and 1 |
Members
(static) BLACK :Common.Color
Represents color Black
Type:
(static) BLUE :Common.Color
Represents color Blue
Type:
(static) GREEN :Common.Color
Represents color Green
Type:
(static) RED :Common.Color
Represents color Red
Type:
(static) TRANSPERENT :Common.Color
Represents transperent color
Type:
(static) WHITE :Common.Color
Represents color White
Type:
Methods
equals(color) → {boolean}
Checks colors equation
Parameters:
Name | Type | Description |
---|---|---|
color | Common.Color |
Returns:
is the same color represented
Type
boolean
toArray() → {Array.<byte>}
Creates a RGBA array from color
Returns:
rgba array
Type
Array.<byte>
toHSLA() → Common.Color.HSLA
Returns:
hsla color
Type
toJSON() → {JSON}
Returns:
Matrix data
Type
JSON
toRGB() → Common.Color
Removes opacity
Returns:
Color without alpha
Type
toRGBA(alpha) → Common.Color
Creates semi-transperant color
Parameters:
Name | Type | Description |
---|---|---|
alpha | float |
Returns:
Color with alpha
Type
toString() → {string}
Creates a rgba string from color
Returns:
css color
Type
string
(static) fromColor(color) → {boolean}
Creates Color instance form color data
Parameters:
Name | Type | Description |
---|---|---|
color | Color|JSON|Array|string | Where string coluld be rgba, rgb or hex string |
Returns:
argument is color
Type
boolean
(static) fromHSLA(hue, saturation, lightness, alpha) → Common.Color
Creates a color from HSLA
Parameters:
Name | Type | Default | Description |
---|---|---|---|
hue | float | 0 | Degrees between 0-359 |
saturation | float | 0 | % between 0-100 |
lightness | float | 0 | % between 0-100 |
alpha | float | Between 0-1 |
Returns:
color
Type
(static) isColor(color) → {boolean}
Checks is argument defines Color
Parameters:
Name | Type | Description |
---|---|---|
color | Color|JSON |
Returns:
argument is color
Type
boolean
Type Definitions
HSLA
Defines HSLA color
Properties:
Name | Type | Description |
---|---|---|
hue | float | Hue as degrees, value between 0-359 |
saturation | float | Saturation as percent, value between 0-100 |
lightness | float | Lightness as percent, value between 0-100 |
alpha | float | Alpha (Opacity) component, value between 0-1 |
RGB
Defines RGB color
Properties:
Name | Type | Description |
---|---|---|
red | byte | Red component, value between 0 and 255 |
green | byte | Green component, value between 0 and 255 |
blue | byte | Blue component, value between 0 and 255 |