web-map/src/assets/themes/_theme.scss

30 lines
547 B
SCSS
Raw Normal View History

2025-05-01 01:07:16 +08:00
@use 'sass:map';
@use './dark' as dark;
@use './light' as light;
$themes: (dark, light);
$theme-map: (
2025-05-02 00:35:53 +08:00
dark-colors: dark.$colors,
2025-05-01 01:07:16 +08:00
2025-05-02 00:35:53 +08:00
light-colors: light.$colors,
2025-05-01 01:07:16 +08:00
);
@mixin themed {
@each $theme in $themes {
2025-05-02 00:35:53 +08:00
$theme: $theme !global;
$theme-colors: map.get($theme-map, #{$theme}-colors) !global;
2025-05-01 01:07:16 +08:00
:root[theme='#{$theme}'] {
@content;
}
}
}
@function get-color($key) {
2025-05-02 00:35:53 +08:00
@return map.get($theme-colors, $key);
}
@function get-icon($name) {
@return url(asset/icons/#{$theme}/#{$name}.png) center / contain no-repeat;
2025-05-01 01:07:16 +08:00
}