Color
As was mentioned in other guides, the color tools can be used to generate a color that can be assigned to style elements in a document.
- Specify a color using its red, green, and blue value
- elementName.Style.ForegroundColor = color.rgb(10,10,10);
- Specify a color using its red, green, blue, alpha
- elementName.Style.BackgroundColor = color.rgba(10,10,10,10);
- Specify a color using its X11 color name
- elementName.Style.ForegroundColor = color.lightSlateGray;
Constructors
- Create a vector from a one-dimensional Lua table
- d = colors({color.blue, color.red, color.rgb(50, 50, 20)});
- Create a vector using a delegate to initialize the elements
- d = colors(3, function (i) return color.rgb(64 * i, 0, 0); end);
- Create a vector with all elements initialized to the given value
- d = colors(3, color.blue);
- Create a vector with all elements initialized to transparent
- d = colors(3);
- Create a dense vector from a one-dimensional Lua table
- d = colors.dense({color.blue, color.magenta, color.green});
- Create a dense vector using a delegate to initialize the elements
- d = colors.dense(3, function (i) return color.rgb(64*i, 0, 20); end);
- Create a dense vector with all elements initialized to the given value
- d = colors.dense(3, color.blue);
- Create a dense vector with all elements initialized to zero
- d = colors.dense(3);
Subvectors
- Return the color subvector starting at the specified index
- v = d:subvector(3)
- Return the color subvector starting at the specified index and having the given length
- v = d:subvector(3, 2)
Miscellaneous
- Return number of color vector elements
- n = d.count
- Return the red component of a color
- n = color.redComponent(d)
- Return the green component of a color
- n = color.greenComponent(d)
- Return the blue component of a color
- n = color.blueComponent(d)
- Return the alpha component of a color
- n = color.alphaComponent(d)
- Set the value at the specified index
- d:at(1, color.blue)
- Clone a color vector
- v = d:clone()
Indexing
- local n = colorVectorName[1];
- ans = myColorVector.at(1);