WebColor
Package: Libraries.Web.Styles · Inherits from: Libraries.Language.Object
WebColor is a color for a style: an amount of red, green and blue, each from 0 to 255, and how opaque it is, from 0 (clear) to 1 (solid). A site names its colors once, in its style options, and its styles use those, so the same color is never typed twice.
Example Code
use Libraries.Web.Styles.WebColor
use Libraries.Web.Styles.WebBoxStyle
WebColor darkBlue
darkBlue:SetColor(18, 90, 119)
WebBoxStyle box
box:SetBackground(darkBlue)
Actions
Copy()
Returns a new color with the same values. Change the copy to make a related color without changing this one.
Returns
Libraries.Web.Styles.WebColor: A copy of this color.
Generate()
Returns the color as stylesheet text. Styles call this when the site writes its stylesheet; people making pages don't.
Returns
text: The color, such as "rgb(18,90,119)".
GetBlue()
Returns
integer
GetGreen()
Sets the color, as amounts of red, green and blue.
Returns
integer
Example
use Libraries.Web.Styles.WebColor
WebColor white
white:SetColor(255, 255, 255)
GetOpacity()
Returns
number
GetRed()
Sets how opaque the color is: 1 is solid, 0 is clear, and 0.5 lets half of what is behind it show through.
Returns
integer
Example
use Libraries.Web.Styles.WebColor
WebColor shade
shade:SetColor(0, 0, 0)
shade:SetOpacity(0.1)
SetColor(integer red, integer green, integer blue)
Sets the color, as amounts of red, green and blue.
Parameters
redinteger: How much red, from 0 to 255.greeninteger: How much green, from 0 to 255.blueinteger: How much blue, from 0 to 255.
Example
use Libraries.Web.Styles.WebColor
WebColor white
white:SetColor(255, 255, 255)
SetOpacity(number value)
Sets how opaque the color is: 1 is solid, 0 is clear, and 0.5 lets half of what is behind it show through.
Parameters
valuenumber: The opacity, from 0 to 1.
Example
use Libraries.Web.Styles.WebColor
WebColor shade
shade:SetColor(0, 0, 0)
shade:SetOpacity(0.1)