Skip to content

Instantly share code, notes, and snippets.

@hagenburger
Last active May 13, 2016 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagenburger/e94ee5c86e25b76b865ffdb2d6dcb095 to your computer and use it in GitHub Desktop.
Save hagenburger/e94ee5c86e25b76b865ffdb2d6dcb095 to your computer and use it in GitHub Desktop.
Use Sass functions in color swatches in your living style guide
@sass colors.scss
@style background-color: change-color($turquoise, $lightness: 98%)
@style color: $pink
# Colors
No you can use Sass functions in color swatches:
@colors {
$pink light($pink) dark($pink)
$turquoise light($turquoise) dark($turquoise)
}
Besides Sass variables and functions, you can also use plain CSS colors like `#ca1f70` or `red`.
Colors swatches are separated by one or more spaces.
[More information](https://github.com/livingstyleguide/livingstyleguide/tree/v2#colors)
$pink: #ca1f70;
$turquoise: #2ef1bd;
@function light($color) {
@return change-color($color, $lightness: 90%);
}
@function dark($color) {
@return change-color($color, $lightness: 30%);
}
# To generate your style guide:
gem install livingstyleguide -v 2.0.0.pre.3
livingstyleguide compile colors.lsg
# open colors.html
# or see the result online at http://hagenburger.net/DOWNLOADS/lsg-sass-color-swatches.html
# Follow @LSGorg on Twitter and watch livingstyleguide/livingstyleguide on GitHub for more updates!
@hagenburger
Copy link
Author

You can see the result online at http://hagenburger.net/DOWNLOADS/lsg-sass-color-swatches.html

Preview of color swatches in the LivingStyleGuide v2.0.0.pre.3

Follow @LSGorg on Twitter and watch livingstyleguide/livingstyleguide on GitHub for more updates!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment