This is a test file for roughdraft.io.
Last active
August 29, 2015 14:07
-
-
Save lunelson/33b1e59459b60f12d6fe to your computer and use it in GitHub Desktop.
Test for Roughdraft.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.5) | |
// Compass (v1.0.1) | |
// ---- | |
// a map of colors with one starter | |
$colors: ( | |
base: green | |
); | |
// mixin to create variants | |
@mixin make-colors(){ | |
$base: map-get($colors, base); | |
$alt1: adjust-hue($base, 180); | |
$alt2: adjust-hue($alt1, 30); | |
$colors: map-merge($colors, (alt1: $alt1, alt2: $alt2)) !global; | |
} | |
// function to retrieve them | |
@function get-color($name, $options: ()) { | |
$lighten: map-get($options, lighten); | |
$darken: map-get($options, darken); | |
$saturate: map-get($options, saturate); | |
$desaturate: map-get($options, desaturate); | |
$color: map-get($colors, $name); | |
@if $color { | |
@if $lighten { $color: call(lighten, $color, $lighten); } | |
@if $darken { $color: call(darken, $color, $darken); } | |
@if $saturate { $color: call(saturate, $color, $saturate); } | |
@if $desaturate { $color: call(desaturate, $color, $desaturate); } | |
} | |
@return $color; | |
} | |
/* usage */ | |
@include make-colors(); | |
.test { | |
color: get-color(base); | |
} | |
.test2 { | |
color: get-color(alt2, (desaturate: 50, lighten: 10)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* usage */ | |
.test { | |
color: green; | |
} | |
.test2 { | |
color: #862d5a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment