构建Spectra颜色
构建参数 支持css {r:number,g:number,b:number,a?:number} {red:number,green:number,blue:number,alplh?:number} [255,255,255,1]
获取或者设置alpha分量
分量值
分量值
获取或设置蓝色值
蓝色值
蓝色值
Returns the complement of this color.
Returns a number from 0 to 1 representing the color contrast between the two colors.
Darkens a color based on percentage value from 1 to 100.
Desaturates the color based on a percentage value.
Tests to see if this color is equal to other. Because other is also a color, it follows that we can simply compare red, green, blue, and alpha to see if the colors are equal.
Fades in the current color based on a percentage value, making it less transparent.
Fades out the current color based on a percentage value, making it less transparent.
获取[0-1]范围的gl颜色数组
范围的gl颜色数组
Returns a gradient of colors approximately from this color to the other, consisting of n colors.
Returns a Spectra object, which is the grayscale of the current color.
获取或设置绿色值
绿色值
绿色值
Harmony
(string) - Type of harmony.
(int) - At which point the original color exists on the set harmonies. Since some types of color harmonies have inconsistent offsets (eg. rectangle) it's useful to note where this original color lies on the set harmony hues.
Array of Spectra instances.
获取#开头的十六进制字符串
十六进制字符串
获取十六进制字符串
0x开头的十六进制字符串
获取带透明度的十六进制字符串
十六进制字符串
获取hsl字符串
hsl字符串
获取hsla字符串
hsla字符串
获取或者设置hsv的分量
分量值
分量值
If a color is dark then it's best to have white text on it. http://24ways.org/2010/calculating-color-contrast
If a color is light then it's best to have black text on it.
获取lab对象
lab对象
Lightens a color based on percentage value from 1 to 100.
获取或者设置hsl的l分量
分量值
分量值
Calculates the luma of the color, i.e. how it appears on screen.
Returns the color that results from mixing percent of the other color into this color.
Tests to see if an other color is within a percentage range of this color.
Negates this color. For a color {R, G, B}, returns a new color {R', G', B'}, where R' = 255 - R and so on.
Lightens or darkens a color based on a random value in the specified range. Percentage should be passed in as an integer, so 40 would lighten or darken up to 40%.
获取或设置红色值
颜色值
获取rgb数字
rgb数字
获取rgba字符串
rgba字符串
Adds saturation to the color based on a percentage value.
获取或者设置hsl的s分量
分量值
分量值
获取或者设置hsv的s分量值
分量值
分量值
获取或者设置hsv的v分量
分量值
分量值
Generates a random color.
Generated using TypeDoc
颜色对象,rgb使用0-255,a使用0-1 改造自:https://github.com/avp/spectra