Skip to content

Instantly share code, notes, and snippets.

@krman009
Created October 31, 2018 11:10
Show Gist options
  • Save krman009/30a70d9eea61eee887b0672bb01d2d31 to your computer and use it in GitHub Desktop.
Save krman009/30a70d9eea61eee887b0672bb01d2d31 to your computer and use it in GitHub Desktop.
Sass map and list
$color-theme: (
primary: #ffcc09,
secondary: #0022be,
accent: #345844
);
@function get-color($color) {
@return map-get($color-theme, $color);
}
.div_first {
color: get-color(primary);
}
.div_second {
color: get-color(secondary);
}
.div_third {
color: get-color(accent);
}
$color-list: (#ffcc09, #0022be, #345844);
.div_fourth {
color: nth($color-list, 1) // lists start with 1 so value will be #ffcc09
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment