Skip to content

Instantly share code, notes, and snippets.

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