在线工具
网站地图    收藏    合作   
<

快捷菜单 返回顶部

fabric.js中文API

fabric.js中文在线API,fabric.js中文文档API大全

Class: Color

fabric.Color

new Color(color) → {fabric.Color}

Color class The purpose of fabric.Color is to abstract and encapsulate common color operations; fabric.Color is a constructor and creates instances of fabric.Color objects. 颜色类 织物的用途。色彩是对常见色彩操作的抽象和封装; 织物。Color是一个构造函数,创建fabric的实例。颜色对象。
Parameters:
Name Type Description
color String optional in hex or rgb(a) or hsl format or from known color list可选的十六进制或rgb(a)或HSL格式或从已知的颜色列表
Source:
Tutorials:
Returns:
thisArg
Type
fabric.Color

Members

(static) colorNameMap

Map of the 148 color names with HEX code 地图的148个颜色名称与十六进制代码
Source:

(static) reHex

Regex matching color in HEX format (ex: #FF5544CC, #FF5555, 010155, aff) HEX格式的正则匹配颜色(例如:#FF5544CC, #FF5555, 010155, aff)
Source:

(static) reHSLa

Regex matching color in HSL or HSLA formats (ex: hsl(200, 80%, 10%), hsla(300, 50%, 80%, 0.5), hsla( 300 , 50% , 80% , 0.5 )) HSL或HSLA格式的正则表达式匹配颜色(例如:HSL (200,80%, 10%), HSLA (300,50%, 80%, 0.5), HSLA (300,50%, 80%, 0.5))
Source:

(static) reRGBa

Regex matching color in RGB or RGBA formats (ex: rgb(0, 0, 0), rgba(255, 100, 10, 0.5), rgba( 255 , 100 , 10 , 0.5 ), rgb(1,1,1), rgba(100%, 60%, 10%, 0.5)) RGB或RGBA格式的正则表达式匹配颜色(例如:RGB (0,0,0), RGBA (255,100,10,0.5), RGBA (255,100,10,0.5), RGB (1,1,1), RGBA (100%, 60%, 10%, 0.5))
Source:

Methods

(static) fromHex(color) → {fabric.Color}

Returns new color object, when given a color in HEX format 当以HEX格式给出颜色时,返回新的颜色对象
Parameters:
Name Type Description
color String Color value ex: FF5555颜色值例如:FF5555
Source:
Returns:
Type
fabric.Color

(static) fromHsl(color) → {fabric.Color}

Returns new color object, when given a color in HSL format 当给定HSL格式的颜色时,返回新的颜色对象
Parameters:
Name Type Description
color String Color value ex: hsl(0-260,0%-100%,0%-100%)颜色值ex: hsl(0- 26,0% -100%,0%-100%)
Source:
Returns:
Type
fabric.Color

(static) fromHsla(color) → {fabric.Color}

Returns new color object, when given a color in HSLA format 当给定HSLA格式的颜色时,返回新的颜色对象
Parameters:
Name Type Description
color String
Source:
Returns:
Type
fabric.Color

(static) fromRgb(color) → {fabric.Color}

Returns new color object, when given a color in RGB format 当给定RGB格式的颜色时,返回新的颜色对象
Parameters:
Name Type Description
color String Color value ex: rgb(0-255,0-255,0-255)颜色值ex: rgb(0-255,0-255,0-255)
Source:
Returns:
Type
fabric.Color

(static) fromRgba(color) → {fabric.Color}

Returns new color object, when given a color in RGBA format 当给定RGBA格式的颜色时,返回新的颜色对象
Parameters:
Name Type Description
color String
Source:
Returns:
Type
fabric.Color

(static) fromSource(source) → {fabric.Color}

Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) 当以数组形式给出颜色时,返回新的颜色对象(例如:[200,100,100,0.5])
Parameters:
Name Type Description
source Array
Source:
Returns:
Type
fabric.Color

(static) sourceFromHex(color) → {Array}

Returns array representation (ex: [100, 100, 200, 1]) of a color that's in HEX format 返回HEX格式颜色的数组表示形式(例如:[100,100,200,1])
Parameters:
Name Type Description
color String ex: FF5555 or FF5544CC (RGBa)例:FF5555或FF5544CC (RGBa)
Source:
Returns:
source
Type
Array

(static) sourceFromHsl(color) → {Array}

Returns array representation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. Adapted from https://github.com/mjijackson 返回HSL或HSLA格式的颜色的数组表示(例如:[100,100,200,1])。 改编自https://github.com/mjijackson
Parameters:
Name Type Description
color String Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1)颜色值例:高速逻辑(0 - 360,0% - -100%,0% - -100%)或hsla (0 - 360, 0% - -100%, 0% - -100%, 0 - 1)
Source:
See:
Returns:
source
Type
Array

(static) sourceFromRgb(color) → {Array}

Returns array representation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format 返回RGB或RGBA格式的颜色的数组表示(例如:[100,100,200,1])
Parameters:
Name Type Description
color String Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%)颜色值的前女友:rgb (0 - 255 0 - 255 0 - 255), rgb (0% -100% 0% -100% 0% -100%)
Source:
Returns:
source
Type
Array

getAlpha() → {Number}

Gets value of alpha channel for this color 获取此颜色的alpha通道的值
Source:
Returns:
0-1
Type
Number

getSource() → {Array}

Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) 返回该颜色的source(其中source是数组表示;例:[200,200,100,1])
Source:
Returns:
Type
Array

overlayWith(otherColor) → {fabric.Color}

Overlays color with another color 用另一种颜色叠加颜色
Parameters:
Name Type Description
otherColor String | fabric.Color
Source:
Returns:
thisArg
Type
fabric.Color

setAlpha(alpha) → {fabric.Color}

Sets value of alpha channel for this color 为这个颜色设置alpha通道的值
Parameters:
Name Type Description
alpha Number Alpha value 0-1Alpha值0-1
Source:
Returns:
thisArg
Type
fabric.Color

setSource(source)

Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) 设置该颜色的source(其中source是一个数组表示;例:[200,200,100,1])
Parameters:
Name Type Description
source Array
Source:

toBlackWhite(threshold) → {fabric.Color}

Transforms color to its black and white representation 将颜色转换为其黑白表示
Parameters:
Name Type Description
threshold Number
Source:
Returns:
thisArg
Type
fabric.Color

toGrayscale() → {fabric.Color}

Transforms color to its grayscale representation 将颜色转换为其灰度表示
Source:
Returns:
thisArg
Type
fabric.Color

toHex() → {String}

Returns color representation in HEX format 以HEX格式返回颜色表示
Source:
Returns:
ex: FF5555
Type
String

toHexa() → {String}

Returns color representation in HEXA format 返回HEXA格式的颜色表示
Source:
Returns:
ex: FF5555CC
Type
String

toHsl() → {String}

Returns color representation in HSL format 返回HSL格式的颜色表示
Source:
Returns:
ex: hsl(0-360,0%-100%,0%-100%)
Type
String

toHsla() → {String}

Returns color representation in HSLA format 返回HSLA格式的颜色表示
Source:
Returns:
ex: hsla(0-360,0%-100%,0%-100%,0-1)
Type
String

toRgb() → {String}

Returns color representation in RGB format 返回RGB格式的颜色表示
Source:
Returns:
ex: rgb(0-255,0-255,0-255)
Type
String

toRgba() → {String}

Returns color representation in RGBA format 返回RGBA格式的颜色表示
Source:
Returns:
ex: rgba(0-255,0-255,0-255,0-1)
Type
String

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com