The namespace for all UF/Colour utility functions, typically for static methods.
- Source:
Methods
(static) RGBToLab(arg0_rgb) → {Array.<number>}
Converts an RGB value to Lab distance.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_rgb |
Array.<number>
|
Returns:
- Type:
-
Array.<number>
(static) componentToHex(arg0_hex_component) → {string}
Converts a single component to hex.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_hex_component |
number
|
Returns:
- Type:
-
string
(static) convertHexToRGB(arg0_hex) → {Array.<number>}
Converts a hex string to RGB.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_hex |
string
|
Returns:
- Type:
-
Array.<number>
(static) convertHexToRGBA(arg0_hex) → {Array.<number>}
Converts a hex string to RGBA.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_hex |
string
|
Returns:
- Type:
-
Array.<number>
(static) convertRGBAToHex(arg0_rgba) → {string}
Converts an RGBA Array to hex.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_rgba |
Array.<number>
|
string
|
Returns:
- Type:
-
string
(static) convertRGBToHex(arg0_rgb) → {string}
Converts an RGB Array to a hex string.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_rgb |
Array.<number>
|
string
|
Returns:
- Type:
-
string
(static) decodeRGBAAsNumber(arg0_rgba) → {number}
Decodes an RGBA pixel to a number.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_rgba |
Array.<number>
|
Returns:
- Type:
-
number
(static) deltaE(arg0_rgb, arg1_rgb) → {number}
Calculates the deltaE between two RGB values.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_rgb |
Array.<number>
|
|
arg1_rgb |
Array.<number>
|
Returns:
- Type:
-
number
(static) encodeNumberAsRGBA(arg0_number) → {Array.<number>}
Encodes a number as an RGBA pixel.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_number |
number
|
Returns:
- Type:
-
Array.<number>
(static) generateRandomColour() → {Array.<number>}
Returns a random [R, G, B] colour.
- Source:
Returns:
- Type:
-
Array.<number>
(static) getBestTextColour(arg0_colour, arg1_optionsopt) → {Array.<number>|string}
Returns the best text colour given a certain colour background. Either 'black'/'white'.
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg0_colour |
Array.<number>
|
string
|
||||||||||||
arg1_options |
Object
|
<optional> |
|
Returns:
- Type:
-
Array.<number>|string
(static) getColour(arg0_colour) → {Array.<number>|any}
Returns the actual [R, G, B, A] colour of a given string. Depends on a browser/HTML context to work.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_colour |
any
|
Returns:
- Type:
-
Array.<number>|any
(static) getLuminance(arg0_colour) → {number}
Returns the luminance of a given colour.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_colour |
Array.<number>
|
string
|
Returns:
- Type:
-
number
(static) randomHex() → {string}
Returns a random hex colour.
- Source:
Returns:
- Type:
-
string
(static) randomRGBA() → {Array.<number>}
Returns a random RGB colour.
- Source:
Returns:
- Type:
-
Array.<number>