Types
Type Aliasesβ
AdaptivePaletteOptionsβ
AdaptivePaletteOptions: {
backgroundColor: {dark:ColorToken;light:ColorToken; };colorBlind:boolean; }
Type declarationβ
backgroundColor?β
optionalbackgroundColor: {dark:ColorToken;light:ColorToken; }
backgroundColor.dark?β
optionaldark:ColorToken
backgroundColor.light?β
optionallight:ColorToken
colorBlind?β
optionalcolorBlind:boolean
Defined inβ
BiasedHuesβ
BiasedHues:
"red-purple"|"yellow-red"|"green-yellow"|"blue-green"|"purple-blue"
Hue biases as seen when transitioning from one hue to another on the color wheel (Lch).
Defined inβ
Collectionβ
Collection:
ColorToken[] |Map<string|number,ColorToken> |Set<ColorToken> |object
Any collection with enumerable keys that can be used to iterate through it to get the values which are expected to be valid color tokens.
Defined inβ
ColorFamilyβ
ColorFamily:
"red"|"green"|"blue"|"yellow"|"red"|"purple"|"gray"
The basic color families (including gray).
Defined inβ
ColorOptionsβ
ColorOptions: {
alpha:number;colorspace:Colorspaces;contrast:number;darkMode:ColorToken;implicitReturn:boolean;lightMode:ColorToken;lightness:number;luminance:number;mode:Colorspaces;saturation:number;temp:number; }
Properties on an instance of the Color class. Some of these properties have corresponding methods.
Type declarationβ
alpha?β
optionalalpha:number
colorspace?β
optionalcolorspace:Colorspaces
contrast?β
optionalcontrast:number
darkMode?β
optionaldarkMode:ColorToken
implicitReturn?β
optionalimplicitReturn:boolean
lightMode?β
optionallightMode:ColorToken
lightness?β
optionallightness:number
luminance?β
optionalluminance:number
mode?β
optionalmode:Colorspaces
saturation?β
optionalsaturation:number
temp?β
optionaltemp:number
Defined inβ
Colorspacesβ
Colorspaces:
"lab"|"rgb"|"lch"|"lch65"|"xyz65"|"xyz"|"lrgb"|"hsv"
The colorspace or mode to use.
Defined inβ
ColorTokenβ
ColorToken:
number|ColorTuple|boolean|string|object
Any recognizable color token.
Defined inβ
ColorTupleβ
ColorTuple: (
number|string)[]
An array of channel values for a color token with the mode (first element of type string) and alpha (last element of type number in the [0,1] range) being optional.
It can also be in different variants as shown below:
Exampleβ
// The first element can either be a string `mode` which denotes the colorspace the channel values are valid in.
const colorTuple = ['rgb',0.1,0.5,0.8]
const colorTupleWithAlpha = ['rgb',0.1,0.5,0.8,0.5]
const colorTupleWithAlphaButNoMode = [0.1,0.5,0.8,0.5]
const colorTupleWithNoAlphaAndMode = [0.1,0.5,0.8]
When omitting the `mode` from the color tuple, be sure to specify the `srcMode` option in when passing it to `token()` or any function that has access to `TokenOptions`.
Defined inβ
DeficiencyOptionsβ
DeficiencyOptions: {
kind:DeficiencyType;severity:number;token:TokenOptions; }
Overrides to specify the type of color blindness and filter intensity.
Type declarationβ
kind?β
optionalkind:DeficiencyType
The type of color vision deficiency. Default is 'red'
severity?β
optionalseverity:number
The intensity of the filter. The exepected value is between [0,1]. Default is 0.1.
token?β
optionaltoken:TokenOptions
Specify the parsing behaviour and change output type of the ColorToken.
Defined inβ
DeficiencyTypeβ
DeficiencyType:
"red"|"blue"|"green"|"mono"
The type of color vision defeciency.
Defined inβ
DiscoverOptionsβ
DiscoverOptions: {
colorspace:Colorspaces;kind:SchemeType[];maxDistance:number;minDistance:number;token:TokenOptions; }
Options for the discover() palette generator function.
Type declarationβ
colorspace?β
optionalcolorspace:Colorspaces
The colorspace to retrieve channel values from.
kind?β
optionalkind:SchemeType[]
The palette type to return.
Default is undefined
maxDistance?β
optionalmaxDistance:number
The minimum distance between colors. May affect finally palette results
Default is the jnd internal constant.
minDistance?β
optionalminDistance:number
The minimum distance between colors. May affect finally palette results. Default is 0
token?β
optionaltoken:TokenOptions
Specify the parsing behaviour and change output type of the ColorToken.
Defined inβ
DistributionOptionsβ
DistributionOptions:
Pick<InterpolatorOptions,"hueFixup"> & {colorspace:Colorspaces;excludeAchromatic:boolean;excludeSelf:boolean;extremum:"min"|"max"|"mean";factor:Factor[];token:TokenOptions; }
Override for factor distributed palettes.
Type declarationβ
colorspace?β
optionalcolorspace:Colorspaces
The colorspace to distribute the specified factor in. Defaults to lch when the passed in mode has no 'chroma' | 'hue' | 'lightness' channel
excludeAchromatic?β
optionalexcludeAchromatic:boolean
Exclude grayscale colors from the distribution operation. Default is false
excludeSelf?β
optionalexcludeSelf:boolean
Exclude the color with the specified extremum from the distribution operation. Default is false
extremum?β
optionalextremum:"min"|"max"|"mean"
The extreme end for the factor we wish to distribute. If mean is picked, it will map the average value of that factor in the passed in collection.
factorβ
factor:
Factor[]
The factor(s) to distribute amongst each color token in the passed in collection.
token?β
optionaltoken:TokenOptions
Specify the parsing behaviour and change output type of the ColorToken.
Defined inβ
DivergingSchemeβ
DivergingScheme:
"Spectral"|"RdYlGn"|"RdBu"|"PiYG"|"PRGn"|"RdYlBu"|"BrBG"|"RdGy"|"PuOr"
The diverging color scheme in the ColorBrewer colormap.
Defined inβ
EarthtoneOptionsβ
EarthtoneOptions:
InterpolatorOptions& {earthtones:"light-gray"|"silver"|"sand"|"tupe"|"mahogany"|"brick-red"|"clay"|"cocoa"|"dark-brown"|"dark"; }
Options for the earthtone() palette generator function.
Type declarationβ
earthtones?β
optionalearthtones:"light-gray"|"silver"|"sand"|"tupe"|"mahogany"|"brick-red"|"clay"|"cocoa"|"dark-brown"|"dark"
- earthtone The earthtone to interpolate with.
Defined inβ
Fact<F>β
Fact<
F>:Fextendstrue? {color:ColorToken;factor:number; } :number
The value of the factor being queried usually a number but can also be falsy like NaN for edge cases or an object with the value of the factor and the color token associated with it.
Type Parametersβ
β’ F
Defined inβ
Factorβ
Factor:
"luminance"|"chroma"|"contrast"|"distance"|"lightness"|"hue"
The color property being queried.
Defined inβ
FilterByOptionsβ
FilterByOptions: {
against:ColorToken;colorspace:Colorspaces;factor:Factor[];ranges: { [F in Factor]?: (number | string)[] } | (number|string)[]; }
Overrides for setting filtering criterion, expected ranges and other behaviour.
Type declarationβ
against?β
optionalagainst:ColorToken
The color to compare the factor with. All the factors are calculated between this color and the ones in the colors array. Only works for the 'distance' and 'contrast' factor.
colorspace?β
optionalcolorspace:Colorspaces
The mode colorspace to perform the sorting operation in. It is ignored when the factor is 'luminance' | 'contrast' | 'distance'.
factor?β
optionalfactor:Factor[]
The factor to use as a filtering criterion.
Default is 'hue'
ranges?β
optionalranges: { [F in Factor]?: (number | string)[] } | (number|string)[]
The targeted start and end ranges for the factor:
- If a single
factoris specified,rangesis expected to be an array. - If multiple
factors are specified thenrangesis expected to be an object with the factor(s) as keys and an array of the start and end as values. - The start and end values can be either numbers or string expressions. The end value is optional but the range value(s) are expected to be in an array.
Defined inβ
HueshiftOptionsβ
HueshiftOptions:
Pick<InterpolatorOptions,"colorspace"|"easingFn"|"num"|"tokenOptions"> & {hueStep:number;maxLightness:number;minLightness:number; }
Options for the hueshift() palette generator function.
Type declarationβ
hueStep?β
optionalhueStep:number
The hue angle to increment each iteration with.
maxLightness?β
optionalmaxLightness:number
maxLightness Maximum lightness value (range 0-100).
minLightness?β
optionalminLightness:number
- minLightness Minimum lightness value (range 0-100).
Defined inβ
InterpolatorOptionsβ
InterpolatorOptions: {
closed:boolean;colorspace:Colorspaces;easingFn: (t) =>number;hueFixup:"longer"|"shorter";kind:"basis"|"monotone"|"natural";num:number;stops:number[];tokenOptions:TokenOptions; }
Options for customizing the color interpolator behaviour. It is extended by some palette utilities
Type declarationβ
closed?β
optionalclosed:boolean
Optional parameter to return the 'closed' variant of the 'kind' of interpolation method which can be useful for cyclical color scales. Default is false
colorspace?β
optionalcolorspace:Colorspaces
The colorspace to perform the color space in. Prefer uniform color spaces for better results such as Lch or Jch.
easingFn()?β
optionaleasingFn: (t) =>number
The easing function to use.
Parametersβ
β’ t: number
Any value between 0 and 1
Returnsβ
number
A number.
hueFixup?β
optionalhueFixup:"longer"|"shorter"
The type of hue fixup to apply to the hue channels during interpolation.
kind?β
optionalkind:"basis"|"monotone"|"natural"
The type of the spline interpolation method. Default is basis.
num?β
optionalnum:number
The amount of samples to return in the result collection.
stops?β
optionalstops:number[]
The positions of color stops to use during interpolation. Each number in the array is assigned to the colors in the collection according to the order the colors are passed in.
Plain objects as collects do not remember insertion order so it may return unexpected results. Preferably use an ArrayLike or Map object.
tokenOptions?β
optionaltokenOptions:TokenOptions
Specify the parsing behaviour and change output type of the ColorToken.
Defined inβ
Orderβ
Order:
"asc"|"desc"
The order to insert elements back into the result collection either ascending ('asc') or descending ('desc').
Defined inβ
PairedSchemeOptionsβ
PairedSchemeOptions:
InterpolatorOptions& {hueStep:number;via:Tone; }
Options for the pair() palette generator function.
Type declarationβ
hueStep?β
optionalhueStep:number
The hue angle to increment each iteration with.
via?β
optionalvia:Tone
The color to pass through during interpolation.
Defined inβ
QualitativeSchemeβ
QualitativeScheme:
"Set2"|"Accent"|"Set1"|"Set3"|"Dark2"|"Paired"|"Pastel2"|"Pastel1"
The qualitative color scheme in the ColorBrewer colormap.
Defined inβ
ScaleValuesβ
ScaleValues:
"050"|"100"|"200"|"300"|"400"|"500"|"600"|"700"|"800"|"900"|"950"
The value of the Tailwind color.
Defined inβ
SchemeOptionsβ
SchemeOptions:
Pick<InterpolatorOptions,"easingFn"|"colorspace"> & {kind:SchemeType[];token:TokenOptions; }
Options for the scheme() palette generator function.
Type declarationβ
kind?β
optionalkind:SchemeType[]
token?β
optionaltoken:TokenOptions
Defined inβ
SchemeTypeβ
SchemeType:
"analogous"|"triadic"|"tetradic"|"complementary"
The scheme to use when creating base palettes.
Defined inβ
SequentialSchemeβ
SequentialScheme:
"OrRd"|"PuBu"|"BuPu"|"Oranges"|"BuGn"|"YlOrBr"|"YlGn"|"Reds"|"RdPu"|"Greens"|"YlGnBu"|"Purples"|"GnBu"|"Greys"|"YlOrRd"|"PuRd"|"Blues"|"PuBuGn"|"Viridis"
The sequential color scheme in the ColorBrewer colormap.
Defined inβ
SortByOptionsβ
SortByOptions: {
against:ColorToken;colorspace:Colorspaces;factor:Factor[];order:"asc"|"desc";relative:boolean; }
Options for specifying sorting conditions.
Type declarationβ
against?β
optionalagainst:ColorToken
The color to compare the factor with.
All the factors are calculated between this color and the ones in the colors array.
Only works for the 'distance' and 'contrast' factor.
colorspace?β
optionalcolorspace:Colorspaces
The colorspace to perform the sorting operation in. It is ignored when the factor is 'luminance' | 'contrast' | 'distance'.
factor?β
optionalfactor:Factor[]
The factor to use for sorting the colors.
order?β
optionalorder:"asc"|"desc"
The arrangement order of the colors either asc | desc. Default is ascending (asc).
relative?β
optionalrelative:boolean
Use the against comparison color when ordering the color tokens.
It has no effect on contrast and distance factors because they're already relative.
Defined inβ
Statsβ
Stats:
{ [T in Factor]: Object & Object }
The default structure of a Stats object as returned by stats() when invoked with default options.
Defined inβ
StatsOptionsβ
StatsOptions: {
against:ColorToken;colorspace:Colorspaces;factor:Factor[];relative:boolean; }
Optional parameters to specify how the data should be computed.
Type declarationβ
against?β
optionalagainst:ColorToken
The color to compare the factor with. All the factors are calculated between this color and the ones in the colors array. Only works for the 'distance' and 'contrast' factor.
colorspace?β
optionalcolorspace:Colorspaces
The colorspace to perform the sorting operation in. It is ignored when the factor is 'luminance' | 'contrast' | 'distance'.
factor?β
optionalfactor:Factor[]
relative?β
optionalrelative:boolean
Choose whether to use the against color token for factors that support it as an overload (that is, all factors except distance and `contrast)
Defined inβ
Tailwindβ
Tailwind:
"indigo"|"gray"|"zinc"|"neutral"|"stone"|"red"|"orange"|"amber"|"yellow"|"lime"|"green"|"emerald"|"teal"|"sky"|"blue"|"violet"|"purple"|"fuchsia"|"pink"|"rose"
Color families in the default TailwindCSS palette.
Defined inβ
TokenOptionsβ
TokenOptions: {
kind:"num"|"arr"|"obj"|"str";normalizeRgb:boolean;numType:"expo"|"hex"|"oct"|"bin";omitAlpha:boolean;omitMode:boolean;srcMode:Colorspaces;targetMode:Colorspaces; }
Overrides to customize the parsing and output behaviour.
Type declarationβ
kind?β
optionalkind:"num"|"arr"|"obj"|"str"
The type of color token to return. Default is 'str'.
normalizeRgb?β
optionalnormalizeRgb:boolean
If true and the passed in color token is an array or plain object and in the srcMode of 'rgb' or 'lrgb',
it will have all channels normalized back to [0,1] range if any of the channe values is beyond 1.
This can help the parser to recognize RGB colors in the [0,255] range which Culori doesn't handle.
Default is true.
numType?β
optionalnumType:"expo"|"hex"|"oct"|"bin"
The type of number to return. Only valid if kind is set to 'number'. Default is 'literal'
omitAlpha?β
optionalomitAlpha:boolean
If the kind is set to 'arr' it will remove the alpha channel value from color tuple. Default is false.
omitMode?β
optionalomitMode:boolean
If the kind is set to 'arr' it will remove the mode string from color tuple. Default is false.
srcMode?β
optionalsrcMode:Colorspaces
The mode in which the channel values are valid in. It is used for color arrays if they have the colorspace string ommitted. Default is 'rgb'.
targetMode?β
optionaltargetMode:Colorspaces
The colorspace in which to return the color object or array in. Default is 'lch'.
Defined inβ
Toneβ
Tone:
"light"|"dark"
The tone to use.