Constructor
A simple RGB color value.
Parameters:
Name | Type | Description |
---|---|---|
args |
object | An object used to initialize the color. If |
- Default Value:
- { r: 0, g: 0, b: 0, transparent: false }
Example
var color = new PSPDFKit.Color({ r: 245, g: 0, b: 0 });
color = color.set("r", 255);
color.r; // => 255
Extends
- Immutable.Record
Members
Methods
Members
The blue value of the color.
Type:
- number
- Default Value:
- 0
The green value of the color.
Type:
- number
- Default Value:
- 0
The red value of the color.
Type:
- number
- Default Value:
- 0
Transparency of the color.
Type:
- boolean
- Default Value:
- false
Simple black (CSS: rgb(0, 0, 0)
)
Type:
Blue (CSS: rgb(36, 131, 199)
)
Type:
Dark grey (CSS: rgb(64, 64, 64)
)
Type:
Green (CSS: rgb(110, 176, 0)
)
Type:
Grey (CSS: rgb(128, 128, 128)
)
Type:
Light blue (CSS: rgb(141, 184, 255)
)
Type:
Light green (CSS: rgb(162, 250, 123)
)
Type:
Light grey (CSS: rgb(192, 192, 192)
)
Type:
Light orange (CSS: rgb(255, 139, 94)
)
Type:
Light red (CSS: rgb(247, 141, 138)
)
Type:
Light yellow (CSS: rgb(252, 238, 124)
)
Type:
Orange (CSS: rgb(243, 149, 0)
)
Type:
Pink (CSS: rgb(255, 114, 147)
)
Type:
Purple (CSS: rgb(255, 0, 255)
)
Type:
Red (CSS: rgb(248, 36, 0)
)
Type:
Transparent (CSS: transparent
)
Type:
Simple white (CSS: rgb(255, 255, 255)
)
Type:
Yellow (CSS: rgb(255, 255, 0)
)
Type:
Methods
Returns a darker version of the current Color.
Parameters:
Name | Type | Description |
---|---|---|
percent |
number | The percentage of lightness between 0 and 100. |
Returns:
A Color with the new values.
- Type
- Color
Example
const color = PSPDFKit.Color.RED.darker(50);
Returns true if the provided color or object and the current Color have the same RGB values.
Parameters:
Name | Type | Description |
---|---|---|
color |
Color | Object | Color instance or RGB object. |
Returns:
True if equal, false otherwise.
- Type
- boolean
Example
const color = PSPDFKit.Color.RED.equals({ r: 248, g: 36, b: 0 });
Returns a lighter version of the current Color.
Parameters:
Name | Type | Description |
---|---|---|
percent |
number | The percentage of lightness between 0 and 100. |
Returns:
A Color with the new values.
- Type
- Color
Example
const color = PSPDFKit.Color.RED.lighter(50);
Modifies the saturation of the Color and returns a new one.
Parameters:
Name | Type | Description |
---|---|---|
percent |
number | The percentage of saturation between 0 and 100. |
Returns:
A Color with the new values.
- Type
- Color
Example
const color = PSPDFKit.Color.RED.saturate(50);
Converts the color to a CSS value (e.g. rgb(255, 0, 0)
).
Returns:
A CSS color value in rgb
format.
- Type
- string
Example
PSPDFKit.Color.RED.toCSSValue(); // => 'rgb(248, 36, 0)'
Converts the color to a Hex value (e.g. #000000
).
Returns:
A CSS color value in hex
format.
- Type
- string
Example
PSPDFKit.Color.RED.toHex(); // => '#f82400'