Skip to content

Instantly share code, notes, and snippets.

@zastrow
Created June 25, 2020 17:46
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 zastrow/35955ff0870d9d7f0c586a1d6f449367 to your computer and use it in GitHub Desktop.
Save zastrow/35955ff0870d9d7f0c586a1d6f449367 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (vundefined)
// Compass (vundefined)
// dart-sass (v1.18.0)
// ----
$color1: deeppink;
$color2: dodgerblue;
$color3: lime;
$colors: (
'primary': $color1,
'secondary': $color2,
'tertiary': $color3
);
@function color($name, $alpha:null) {
$color: map-get($colors, $name);
@if $alpha {
@return rgba($color, 0.6);
}
@else {
@return $color;
}
}
.normal {
color: color(primary);
}
.transparent {
color: color(primary, alpha);
}
.util-color {
@each $key, $value in $colors {
&-#{$key} {
color: color($key);
}
&-#{$key}-transparent {
color: color($key, true);
}
}
}
.normal {
color: deeppink;
}
.transparent {
color: rgba(255, 20, 147, 0.6);
}
.util-color-primary {
color: deeppink;
}
.util-color-primary-transparent {
color: rgba(255, 20, 147, 0.6);
}
.util-color-secondary {
color: dodgerblue;
}
.util-color-secondary-transparent {
color: rgba(30, 144, 255, 0.6);
}
.util-color-tertiary {
color: lime;
}
.util-color-tertiary-transparent {
color: rgba(0, 255, 0, 0.6);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment