61 lines
994 B
SCSS
61 lines
994 B
SCSS
$limeThemes: light, dark;
|
|
$theme: light;
|
|
|
|
@mixin use-theme($mode: null) {
|
|
@if $mode != null {
|
|
/* #ifndef UNI-APP-X && APP || APP-NVUE */
|
|
@media (prefers-color-scheme: $mode) {
|
|
@content;
|
|
}
|
|
/* #endif */
|
|
/* #ifdef UNI-APP-X && APP || APP-NVUE */
|
|
&.#{$mode} {
|
|
@content;
|
|
}
|
|
/* #endif */
|
|
} @else {
|
|
@each $mode in $limeThemes {
|
|
$theme: $mode !global;
|
|
/* #ifndef UNI-APP-X && APP || APP-NVUE */
|
|
@media (prefers-color-scheme: $mode) {
|
|
@content;
|
|
}
|
|
/* #endif */
|
|
|
|
/* #ifdef UNI-APP-X && APP || APP-NVUE */
|
|
&.#{$mode} {
|
|
@content;
|
|
}
|
|
/* #endif */
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
@mixin theme-dark {
|
|
/* #ifndef UNI-APP-X && APP || APP-NVUE */
|
|
@media (prefers-color-scheme: dark) {
|
|
page {
|
|
@content;
|
|
}
|
|
}
|
|
/* #endif */
|
|
/* #ifdef UNI-APP-X && APP || APP-NVUE */
|
|
.dark {
|
|
@content;
|
|
}
|
|
/* #endif */
|
|
/* #ifdef WEB */
|
|
:root[data-lime-theme='dark'] page {
|
|
@content;
|
|
}
|
|
/* #endif */
|
|
}
|
|
|
|
|
|
@function get-var($themes, $key) {
|
|
@return map-get($themes, $key)
|
|
}
|
|
|
|
|