Skip to content

Instantly share code, notes, and snippets.

@lunelson
Last active August 29, 2015 14:07
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 lunelson/33b1e59459b60f12d6fe to your computer and use it in GitHub Desktop.
Save lunelson/33b1e59459b60f12d6fe to your computer and use it in GitHub Desktop.
Test for Roughdraft.io

Test file.

This is a test file for roughdraft.io.

// ----
// 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));
}
/* 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