User Tools

Site Tools



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

Link to this comparison view

harlowe:hsl [2017/06/19 00:57]
l created
harlowe:hsl [2017/10/09 20:39]
Line 1: Line 1:
-**(hsl: // [[harlowe:​Number|number]],​ Number, Number//) -> //​[[harlowe:​Colour|colour]]//​** 
-This macro creates a [[harlowe:​colour|colour]] using the given hue (h) angle in degrees, as well as the given 
-saturation (s) and lightness (l) percentages. 
-=== Example usage: === 
-  * ''​%%(hsl:​ 120, 0.8, 0.5)%%''​ produces a colour with 120 degree hue, 80% saturation and 50% lightness. 
-  * ''​%%(hsl:​ 28, 1, 0.4)'s h%%''​ produces the [[harlowe:​number|number]] 28. 
-=== Rationale: === 
-The HSL colour model is regarded as easier to work with than the RGB model used for HTML hexadecimal 
-notation and the [[harlowe:​rgb|(rgb:​)]] macro. Being able to set the hue with one number instead of three, for 
-instance, lets you control the hue using a single variable, and alter it at will. 
-=== Details: === 
-This macro takes the same range of numbers as the CSS ''​%%hsl()%%''​ function. 
-Giving saturation or lightness values higher than 1 or lower than 0 will cause an error. However, 
-you can give any kind of hue number to (hsl:), and it will automatically round it to fit the 0-359 
-degree range. This allows you to cycle through hues easily by providing a steadily increasing variable or 
-a counter, such as ''​%%(hsl:​ time / 100, 1, 0.5)%%''​. 
-=== See also: === 
-[[harlowe:​rgb|(rgb:​)]],​ [[harlowe:​rgba|(rgba:​)]],​ [[harlowe:​hsla|(hsla:​)]] 
harlowe/hsl.txt ยท Last modified: 2017/10/09 20:39 (external edit)