颜色辅助模块
Methods
-
staticmodule:zrender/tool/color.alpha(color, a){string}
tool/color.js, line 780 -
设置颜色透明度
Name Type Description colorstring 颜色
anumber 透明度,区间[0,1]
-
staticmodule:zrender/tool/color.getColor(idx, userPalete){string}
tool/color.js, line 203 -
获取色板颜色
Name Type Description idxnumber 色板位置
userPaleteArray.<string> optional 自定义色板
-
staticmodule:zrender/tool/color.getGradientColors(colors, step){Array.<string>}
tool/color.js, line 321 -
获取指定级数的渐变颜色数组
Name Type Default Description colorsArray.<string> 颜色组
stepnumber 20 optional 渐变级数
-
staticmodule:zrender/tool/color.getRadialGradient(x0, y0, r0, x1, y1, r1, colorList){CanvasGradient}
tool/color.js, line 242 -
径向渐变
Name Type Description x0number 渐变起点
y0number r0number x1number 渐变终点
y1number r1number colorListArray 颜色列表
-
staticmodule:zrender/tool/color.lift(color, level){string}
tool/color.js, line 598 -
颜色加深或减淡,当level>0加深,当level<0减淡
Name Type Description colorstring 颜色
levelnumber 升降程度,取值区间[-1,1]
-
staticmodule:zrender/tool/color.mix(color1, color2, weight){string}
tool/color.js, line 647 -
简单两种颜色混合
Name Type Description color1string 第一种颜色
color2string 第二种颜色
weightnumber 混合权重[0-1]
-
staticmodule:zrender/tool/color.normalize(color){string}
tool/color.js, line 568 -
颜色规范化
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.reverse(color){string}
tool/color.js, line 626 -
颜色翻转,[255-r,255-g,255-b,1-a]
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toArray(color){Array.<number>}
tool/color.js, line 390 -
颜色字符串转换为rgba数组
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toHSB(color){string}
tool/color.js, line 513 -
转换为HSB颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toHSBA(color){string}
tool/color.js, line 503 -
转换为HSBA颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toHSL(color){string}
tool/color.js, line 533 -
转换为HSL颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toHSLA(color){string}
tool/color.js, line 523 -
转换为HSLA颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toHSV(color){string}
tool/color.js, line 493 -
转换为HSV颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toHSVA(color){string}
tool/color.js, line 483 -
转换为HSV颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toHex(color){string}
tool/color.js, line 473 -
转换为16进制颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toRGB(color){string}
tool/color.js, line 463 -
转换为rgb数字格式的颜色
Name Type Description colorstring 颜色
-
staticmodule:zrender/tool/color.toRGBA(color){string}
tool/color.js, line 453 -
转换为rgba格式的颜色
Name Type Description colorstring 颜色