Last active
August 29, 2015 13:58
-
-
Save tbremer/10227815 to your computer and use it in GitHub Desktop.
Better Colors using SASS 3.3 Functions & Maps
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
html { | |
background-color: #a6a6a6; | |
} | |
body { | |
color: #9794ca; | |
} | |
a { | |
color: blue; | |
} |
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.3.4) | |
// Compass (v1.0.0.alpha.18) | |
// ---- | |
//--- SASSMESITER.COM ---\\ | |
@function base($pallette){ | |
@return map-get($base_palette, $pallette); | |
} | |
@function clr($palette, $tone: 'base') { | |
@return map-get(map-get($palettes, $palette), $tone); | |
} | |
@mixin bg($color, $tone:base){ | |
background-color: clr($color, $tone); | |
} | |
$base_palette: ( | |
black: #333, | |
blue: #00f, | |
purple: rgb(42,40,80) | |
); | |
$palettes: ( | |
black: ( | |
base: base(black), | |
light: lighten( base(black), 15% ), | |
xlight: lighten( base(black), 45% ), | |
dark: darken( base(black), 15% ), | |
xdark: darken( base(black), 45% ), | |
), | |
blue: ( | |
base: base(blue), | |
light: lighten( base(blue), 15% ), | |
xlight: lighten( base(blue), 45% ), | |
dark: darken( base(blue), 15% ), | |
xdark: darken( base(blue), 45% ), | |
), | |
purple: ( | |
base: base(purple), | |
light: lighten( base(purple), 15% ), | |
xlight: lighten( base(purple), 45% ), | |
dark: darken( base(purple), 15% ), | |
xdark: darken( base(purple), 45% ), | |
) | |
); | |
html{ @include bg(black, xlight); } | |
body{ color: clr(purple, xlight); } | |
a{ color: clr(blue); } |
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
html { | |
background-color: #a6a6a6; | |
} | |
body { | |
color: #9794ca; | |
} | |
a { | |
color: blue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment