Skip to content

Instantly share code, notes, and snippets.

@owain-stratton
Last active February 13, 2017 16:28
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 owain-stratton/a4cd62bb08d14020924d5385a389c748 to your computer and use it in GitHub Desktop.
Save owain-stratton/a4cd62bb08d14020924d5385a389c748 to your computer and use it in GitHub Desktop.
Example for color themes with sass maps
$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