Color

The Color object can be used to define, detect, modify and mix colors. Colors can be defined using either a string value or an object. All colors are converted to a Color object with r, g, b, h, s, land an a value.
译:颜色对象可用于定义、检测、修改和混合颜色。颜色可以定义使用字符串值或对象。所有的颜色都转换为一个颜色对象与r、g、bh、s、la值。

bg = new BackgroundLayer
    backgroundColor: "#28affa"

print bg.backgroundColor
# 

Supported color models: CSS Names, HEX, RGB, RGBA, HSL and HSLA.
译:颜色模式:支持CSS的名字,HEX,RGB,RGBA,HSL和HSLA。

# Multiple ways to define the same color:   
blue = new Color("blue")
blue = new Color("#28AFFA")
blue = new Color("rgb(255, 0, 102)")
blue = new Color("rgba(255, 0, 102, 1)")
blue = new Color("hsl(201, 95, 57)")
blue = new Color("hsla(201, 95, 57, 1)")

You can also create new Color objects and pass in strings, or objects:
译:您还可以创建新的颜色对象,并传递字符串或对象:

# Define a color with a HEX string 
bg = new BackgroundLayer
    backgroundColor: new Color("#fff")

# Define a color with an RGB object 
layerA = new Layer
    backgroundColor: new Color(r: 255, g: 255, b: 255)

# Define a color with an HSL object 
layerB = new Layer
    backgroundColor: new Color(h: 360, s: 1, l: 1, a: 1)

results matching ""

    No results matching ""