Skip to content

Instantly share code, notes, and snippets.

@ivcreative
Forked from janmarsicek/palettes.scss
Created December 16, 2020 20:45
Show Gist options
  • Save ivcreative/8bb7b6cbba94df835a861d67de649750 to your computer and use it in GitHub Desktop.
Save ivcreative/8bb7b6cbba94df835a861d67de649750 to your computer and use it in GitHub Desktop.
Friendlier colour names with Sass maps from http://erskinedesign.com/blog/friendlier-colour-names-sass-maps/
// config
$_color-base-grey: rgb(229,231,234);
$palettes: (
purple: (
base: rgb(42,40,80),
light: rgb(51,46,140),
dark: rgb(40,38,65)
),
grey: (
base: $_color-base-grey,
light: lighten($_color-base-grey, 10%),
dark: darken($_color-base-grey, 10%)
)
);
// Palette function,
@function palette($palette, $tone: 'base') {
@return map-get(map-get($palettes, $palette), $tone);
}
// in module styles
a {
color: palette(purple);
&:hover {
color: palette(purple, light);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment