Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vugar005/99d61973f92664640258ac24dec49f31 to your computer and use it in GitHub Desktop.
Save vugar005/99d61973f92664640258ac24dec49f31 to your computer and use it in GitHub Desktop.
generate angular material classes and css variables: optimized version
@use '../palette';
@mixin generateColors($prefix, $palette) {
$colors-map: ();
@each $key, $value in $palette {
@if $key !=contrast {
.app-#{$prefix}-#{$key} {
color: map-get($palette, $key);
}
$map: ();
$map: map-merge($map, ($key: $value));
$colors-map: map-merge($colors-map, $map);
}
}
:root {
@each $key, $value in $colors-map {
--app-#{$prefix}-#{$key}: #{$value};
}
}
}
@mixin generate-material-classes {
@include generateColors(primary, $youtube-primary);
@include generateColors(accent, $youtube-accent);
@include generateColors(warning, $youtube-warning);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment