Skip to content

Commit

Permalink
Add rgb documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rktjmp committed May 29, 2022
1 parent db01fef commit f77186b
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions doc/lush.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ HSL & HSLuv Colors |lush-hsl-colors| |lush-hsluv-colors|
abs_* |lush-color-absolute-operations|
hue, saturation, lightness, .h, .s, .l |lush-color-direct|
.hex, tostring |lush-color-string-coercion|
.rgb |lush-color-rgb|
Example |lush-color-example|
Lush Spec |lush-spec|
Sample lush-spec |lush-spec-sample|
Expand Down Expand Up @@ -205,9 +206,28 @@ And access members with,

.hex, tostring *lush-color-string-coercion*

Finally, HSL colors can be coerced into a hex string, either by concatenation
with another string, passing to a function which will invoke tostring() or
accessing the `.hex` accessor.
HSL colors can be coerced into a hex string, either by concatenation
with another string, passing to a function which will invoke tostring()
or accessing the `.hex` accessor.

Example *lush-color-example*
>
local hsl = require('lush').hsl -- include the module
local red = hsl(0, 100, 50) -- define a color
local light_red = red.lighten(20) -- modify
local orange = red.hue(20) -- set
local sum_hues = red.h + light_red.h + orange.h -- access
local chained_compliment = red.ro(180) -- chain via aliases
.da(30)
.sa(10)
print(red) -- as string "#FF0000"
<

.rgb() *lush-color-rgb*

HSL colors can be converted to RGB values, this should only be done
outside of a Lush spec, when you are intending to extract the red, green
and blue values for use elsewhere.

Example *lush-color-example*
>
Expand Down

0 comments on commit f77186b

Please sign in to comment.