toFormat(
(format: ColorFormat
)): Color | Converts the color to the given color format, and returns a new Color object. |
toString(
(format: ColorFormat
| | 'css'
)): string | Converts the color to a string in the given format. |
clone(): Color | Returns a duplicate of the color value. |
toHexInt(): number | Converts the color to hex, and returns an integer representation. |
getChannelValue(
(channel: ColorChannel
)): number | Returns the numeric value for a given channel.
Throws an error if the channel is unsupported in the current color format. |
withChannelValue(
(channel: ColorChannel,
, value: number
)): Color | Sets the numeric value for a given channel, and returns a new Color object.
Throws an error if the channel is unsupported in the current color format. |
getChannelRange(
(channel: ColorChannel
)): ColorChannelRange | Returns the minimum, maximum, and step values for a given channel. |
getChannelName(
(channel: ColorChannel,
, locale: string
)): string | Returns a localized color channel name for a given channel and locale,
for use in visual or accessibility labels. |
formatChannelValue(
(channel: ColorChannel,
, locale: string
)): string | Formats the numeric value for a given channel for display according to the provided locale. |
getColorSpace(): ColorFormat | Returns the color space, 'rgb', 'hsb' or 'hsl', for the current color. |
getColorSpaceAxes(
(xyChannels: {}
)): ColorAxes | Returns the color space axes, xChannel, yChannel, zChannel. |
getColorChannels(): [
ColorChannel,
ColorChannel,
ColorChannel
] | Returns an array of the color channels within the current color space space. |
getColorName(
(locale: string
)): string | Returns a localized name for the color, for use in visual or accessibility labels. |
getHueName(
(locale: string
)): string | Returns a localized name for the hue, for use in visual or accessibility labels. |