Skip to content

Instantly share code, notes, and snippets.

@lucadegasperi
Created April 26, 2015 17:33
Show Gist options
  • Save lucadegasperi/cb9e756d80fb855b86b8 to your computer and use it in GitHub Desktop.
Save lucadegasperi/cb9e756d80fb855b86b8 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
// per ogni tema dichiaro la palette
$themes: (
theme1: (
base-color: red
),
theme2: (
base-color: blue
)
);
@mixin skin($props) {
@each $key, $value in $themes {
.t-#{$key} & {
@each $property, $color in $props {
@if map-get($value, $color) != null {
#{$property}: map-get($value, $color);
} @else {
@warn 'color is missing from theme';
}
}
}
}
}
// applico i colori del tema all elemento
a {
@include skin((color: base-color, background: base-color));
}
.t-theme1 a {
color: red;
background: red;
}
.t-theme2 a {
color: blue;
background: blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment