// 自动 浅色、暗色 模式
// 默认跟随系统自动开启

$darkmode: true !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;
        }
    }
}













