Instantly share code, notes, and snippets.

Embed
What would you like to do?
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