Created
April 24, 2022 14:12
-
-
Save vugar005/99d61973f92664640258ac24dec49f31 to your computer and use it in GitHub Desktop.
generate angular material classes and css variables: optimized version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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