summaryrefslogtreecommitdiffstats
path: root/src/_core.scss
blob: 3427579445e7306fab716c348a99f2c171d61c65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@use "sass:map";
@use "sass:meta";
@use "sass:string";
@use "pkg:iro-sass/bem";
@use "pkg:iro-sass/props";
@use "config";

@use "core.vars" as vars;
@forward "core.vars";

@mixin styles {
	@each $theme-name, $theme in vars.$themes {
		@if $theme-name == config.$theme-default {
			:root {
				@include props.materialize(map.values(meta.module-variables("vars")));

				@if map.has-key($theme, "dark") {
					@media (prefers-color-scheme: dark) {
						@include props.materialize(map.get($theme, "dark"));
					}
				}
			}

			@if map.has-key($theme, "dark") and config.$explicit-dark-theme {
				@include bem.theme("dark") {
					@include props.materialize(map.values(meta.module-variables("vars")));
					@include props.materialize(map.get($theme, "dark"));
				}
			}
		} @else {
			@include bem.theme(string.slice($theme-name, 3)) {
				@include props.materialize(map.get($theme, "light"));

				color: props.get(vars.$theme, --text);
				background-color: props.get(vars.$theme, --bg-base);

				@if map.has-key($theme, "dark") {
					@media (prefers-color-scheme: dark) {
						@include props.materialize(map.get($theme, "dark"));
					}
				}
			}
		}
	}
}