Skip to content

Instantly share code, notes, and snippets.

@suisho
Created January 30, 2015 14:41
Show Gist options
  • Save suisho/83788e9d14e7f9608b9f to your computer and use it in GitHub Desktop.
Save suisho/83788e9d14e7f9608b9f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
// http://erskinedesign.com/blog/friendlier-colour-names-sass-maps/
//http://maketea.co.uk/2014/07/21/managing-relationships-between-colours-with-sass.html
// setting
$color-palette :(
red : (
base : #ff0000,
dark : #ffcccc
),
blue : (
base : #0000ff,
light : #00bbff,
)
) !default;
// color(色系統, トーン)
@function color($color, $tone){
@return map-get(map-get($color-palette, $color), $tone)
}
@each $name, $palette in $color-palette {
@each $tone, $code in $palette {
.sample-color-palette-#{$name}-#{$tone}{
background : color($name, $tone);
.black-text{ color : #000 };
.white-text{ color: #fff };
}
}
}
.sample-color-palette-red-base {
background: red;
}
.sample-color-palette-red-base .black-text {
color: black;
}
.sample-color-palette-red-base .white-text {
color: white;
}
.sample-color-palette-red-dark {
background: #ffcccc;
}
.sample-color-palette-red-dark .black-text {
color: black;
}
.sample-color-palette-red-dark .white-text {
color: white;
}
.sample-color-palette-blue-base {
background: blue;
}
.sample-color-palette-blue-base .black-text {
color: black;
}
.sample-color-palette-blue-base .white-text {
color: white;
}
.sample-color-palette-blue-light {
background: #00bbff;
}
.sample-color-palette-blue-light .black-text {
color: black;
}
.sample-color-palette-blue-light .white-text {
color: white;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment