User Tools

Site Tools


harlowe:rgb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

harlowe:rgb [2017/10/09 20:39] (current)
Line 1: Line 1:
 +**(rgb: // [[harlowe:​Number|Number]],​ Number, Number//) -> //​[[harlowe:​Colour|colour]]//​**
  
 +This macro creates a [[harlowe:​colour|colour]] using the three red (r), green (g) and blue (b) values
 +provided, whose values are whole [[harlowe:​number|number]] between 0 and 255.
 +
 +=== Example usage: ===
 +
 +  * ''​%%(rgb:​ 255, 0, 47)%%''​ produces a colour with 255 red, 0 blue and 47 green.
 +  * ''​%%(rgb:​ 90, 0, 0)'s r%%''​ produces the number 90.
 +
 +=== Rationale: ===
 +
 +The RGB additive colour model is commonly used for defining colours: the HTML
 +hexadecimal notation for colours (such as #9263AA) simply consists of three hexadecimal
 +values placed together. This macro allows you to create such colours computationally,​
 +by providing variables for certain components.
 +
 +=== Details: ===
 +
 +This macro takes the same range of numbers as the CSS ''​%%rgb()%%''​ function.
 +
 +Giving values higher than 255 or lower than 0, or with a fractional part,
 +will cause an error.
 +
 +=== See also: ===
 +
 +[[harlowe:​rgba|(rgba:​)]],​ [[harlowe:​hsl|(hsl:​)]],​ [[harlowe:​hsla|(hsla:​)]]
harlowe/rgb.txt ยท Last modified: 2017/10/09 20:39 (external edit)