Skip to content

textmode.js / Textmodifier / colorMode

Method: colorMode()

Call Signature

ts
colorMode(): TextmodeColorModeState;

Current color interpretation mode.

Returns

TextmodeColorModeState

Current color mode and channel maxes.

Example

Call Signature

ts
colorMode(mode, max?): void;

Set how numeric color inputs are interpreted.

Supported modes are 'rgb', 'hsb', and 'hsl'. Passing one max uses that range for all channels. Passing per-channel maxes uses maxA for alpha, defaulting to the selected mode's alpha max.

Parameters

ParameterTypeDescription
modeTextmodeColorModeColor mode to use for numeric colors.
max?numberShared channel max.

Returns

void

Example

Call Signature

ts
colorMode(
   mode, 
   max1, 
   max2, 
   max3, 
   maxA?): void;

Set how numeric color inputs are interpreted with per-channel ranges.

Parameters

ParameterTypeDescription
modeTextmodeColorModeColor mode to use for numeric colors.
max1numberRed or hue max.
max2numberGreen or saturation max.
max3numberBlue, brightness, or lightness max.
maxA?numberAlpha max.

Returns

void

Example