Last active
February 13, 2017 16:28
-
-
Save owain-stratton/a4cd62bb08d14020924d5385a389c748 to your computer and use it in GitHub Desktop.
Example for color themes with sass 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
$baseColor: rgb(255, 255, 255); | |
$palette-settings: ( | |
primary: ( | |
base: rgb(76, 40, 24), | |
terracotta: rgb(168, 102, 78), | |
grey: rgb(94, 91, 84), | |
tan: rgb(180, 120, 65), | |
creme: rgb(161, 146, 111) | |
), | |
secondary: ( | |
base: rgb(212, 100, 22), | |
deepOrange: rgb(142, 55, 1), | |
grey: rgb(113, 101, 88), | |
slate: rgb(35, 35, 33), | |
creme: rgb(144, 132, 118) | |
) | |
); | |
@function palette($theme, $tone: base) { | |
@return map-get(map-get($palette-settings, $theme), $tone); | |
} | |
/* | |
Use case example | |
*/ | |
body { | |
background-color: palette(secondary, slate); // this will be secondary->slate | |
} | |
div { | |
color: palette(primary); // this will be primary->base | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment