new ColorUtils()
ColorUtils provides several method to abstract color manipulation for canvas
This class doesn't need to be instantiated, as all its methods are static in order to make those utils methods available without constraints. Refer to each method for their associated documentation.
- Since:
- 2020
- Source:
Members
(static) defaultAntiPrimaryColor :string
The default anti primary color, #FF6B67
Type:
- string
- Source:
(static) defaultAudioGradient :Array.<string>
The default color array to be used in gradient, ['#56D45B', '#AFF2B3', '#FFAD67', '#FF6B67', '#FFBAB8']
Type:
- Array.<string>
- Source:
(static) defaultBackgroundColor :string
The default background color, #1D1E25
Type:
- string
- Source:
(static) defaultDarkPrimaryColor :string
The default dark primary color, #12B31D
Type:
- string
- Source:
(static) defaultLoopAlphaColor :string
The default dark primary color, #FFAD67
Type:
- string
- Source:
(static) defaultLoopColor :string
The default dark primary color, #FFAD67
Type:
- string
- Source:
(static) defaultPrimaryColor :string
The default primary color, #56D45B
Type:
- string
- Source:
(static) defaultTextColor :string
The default text color, #E7E9E7
Type:
- string
- Source:
Methods
(static) alphaColor(color, alpha) → {string}
Add transparency on an existing color.
Parameters:
Name | Type | Description |
---|---|---|
color |
string | The color to make transparent in Hex |
alpha |
number | The amount of transparency applied on color in Float[0,1] |
- Since:
- 2020
- Source:
Returns:
The transparent color in rgba
- Type
- string
(static) drawRadialGradient(canvas, options)
Fill context with radial gradient according to options object.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
canvas |
object | The canvas to draw radial gradient in |
||||||||||||||||||||||||
options |
object | Radial gradient options Properties
|
- Since:
- 2020
- Source:
(static) lightenDarkenColor(color, amount) → {string}
Lighten or darken a given color from an amount. Inspired from https://jsfiddle.net/gabrieleromanato/hrJ4X/
Parameters:
Name | Type | Description |
---|---|---|
color |
string | The color to alter in Hex |
amount |
number | The percentage amount to lighten or darken in Float[-100,100] |
- Since:
- 2020
- Source:
Returns:
The altered color in Hex
- Type
- string
(static) linearGradient(canvas, options) → {object}
Returns a linear gradient according to options object.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
canvas |
object | The canvas to draw radial glowing gradient in |
||||||||||||
options |
object | Linear gradient options Properties
|
- Since:
- 2021
- Source:
Returns:
The linear gradient to apply
- Type
- object
(static) radialGlowGradient(canvas, options) → {object}
Returns a radial glowing gradient according to options object.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
canvas |
object | The canvas to draw radial glowing gradient in |
|||||||||||||||
options |
object | Radial glowing gradient options Properties
|
- Since:
- 2020
- Source:
Returns:
The radial glowing gradient to apply
- Type
- object
(static) rainbowLinearGradient(canvas, verticalopt) → {object}
Returns a vertical or horizontal rainbow gradient.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
canvas |
object | The canvas to create gradient from |
||
vertical |
boolean |
<optional> |
false | The gradient orientation, default to horizontal |
- Since:
- 2020
- Source:
Returns:
The rainbow gradient to apply
- Type
- object