优化组件/更新
This commit is contained in:
60
uni_modules/lime-style/mixins/useTheme.scss
Normal file
60
uni_modules/lime-style/mixins/useTheme.scss
Normal file
@@ -0,0 +1,60 @@
|
||||
$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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user