This repository has been archived on 2025-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
Files
redemption/source/css/base/_variables.scss
zopiya 4682bede9f refacotr(css): Refactor css for easy maintenance
1. Refactored CSS for robustness
2. Add dark-mode choose
3. Add sans and serif
2022-01-17 19:51:11 +08:00

57 lines
1.2 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$darkmode: manual !default; // true | false | 'manual'
$manualmode-auto-selector: '[data-darkmode="auto"] &' !default;
$manualmode-dark-selector: '[data-darkmode="dark"] &' !default;
@mixin darkmode($darkmode: $darkmode, $dark-selector: $manualmode-dark-selector, $auto-selector: $manualmode-auto-selector) {
// darkmode = ture : 跟随系统
// darkmode = false : 不跟随系统
// darkmode = manual : 手动模式
@if $darkmode=='manual' {
#{$dark-selector} {
@content;
}
@media (prefers-color-scheme: dark) {
#{$auto-selector} {
@content;
}
}
}
@else if $darkmode {
@media (prefers-color-scheme: dark) {
@content;
}
}
}
// 超小屏幕(手机,小于 768px
// @media (max-width: 768px) { ... }
// 小屏幕(平板,大于等于 768px
// @media (min-width: 768px) and (max-width: 768px) { ... }
// 中等屏幕(桌面显示器,大于等于 992px
// @media (min-width: 992px) and (max-width: 992px) { ... }
// 大屏幕(大桌面显示器,大于等于 1200px
// @media (min-width: 1200px) { ... }