Skip to content

Commit

Permalink
Improve code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
meduzen committed Aug 15, 2019
1 parent 2d6a7f9 commit b018428
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# hsl.scss

[HSL colors](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#HSL_colors) [are awesome](https://www.sarasoueidan.com/blog/hex-rgb-to-hsl/). Unfortunately, the [SASS `hsl()` and `hsla()` functions](https://sass-lang.com/documentation/functions/color#hsl) converts the colors to RGB/RGBA format.
Expand All @@ -14,15 +15,26 @@ _hsl.scss_ replaces the two SASS functions by two others, preserving HSL(A) colo
Write regular CSS, the syntax is exactly the same:
```scss
:root {

// hsl()
color: hsl(15deg, 100%, 50%);
--flashy-pink: hsl(15deg, 100%, 50%); // coma as separator
$flashy-pink: hsl(15deg 100% 50%); // space as separator

// separator: coma (`,`)
--flashy-pink: hsl(15deg, 100%, 50%);

// separator: space
$flashy-pink: hsl(15deg 100% 50%);

// hsl() accepts opacity as fourth parameter 👇
--hue: 15deg;
--transparent-flashy-pink: hsl(var(--hue), 100%, 50%, .7);
$transparent-flashy-pink: hsla(15deg, 100%, 50%, .7); // opacity after a coma
$transparent-flashy-pink: hsla(15deg 100% 50% / .7); // opacity after a slash

// hsla()
$transparent-flashy-pink: hsla(15deg, 100%, 50%, .7);

// hsla(): opacity after a slash (`/`) when separator is a space
$transparent-flashy-pink: hsla(15deg 100% 50% / .7);
}
```

There’s currently no test enforcing the validity of what is passed to `hsl()` and `hsla()`.
There’s currently no test enforcing the validity of what is passed to `hsl()` and `hsla()`, like in CSS. They are _passthrough_ function.

0 comments on commit b018428

Please sign in to comment.