Skip to content

Commit

Permalink
fix: theme mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
fengtianze committed Feb 24, 2022
1 parent 5575376 commit 685f5fd
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/theme/_mixin.scss
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
@import 'base-var';
@import 'var';

@function theme-selector($theme, $scope) {
@if ($scope) {
@return selector-nest($theme, $scope);
} @else {
@return $theme;
}
}

@mixin theme-light {
$host: &;
$scope: &;

@at-root {
:root #{$host} {
#{theme-selector(':root', $scope)} {
@content;
}

html[aui-theme-mode='light'] #{$host} {
#{theme-selector('html[aui-theme-mode=light]', $scope)} {
@content;
}
}
}

@mixin theme-dark {
$host: &;
$scope: &;

@at-root {
@media (prefers-color-scheme: dark) {
html[aui-theme-mode='system'] #{$host} {
#{theme-selector('html[aui-theme-mode=system]', $scope)} {
@content;
}
}

html[aui-theme-mode='dark'] #{$host} {
#{theme-selector('html[aui-theme-mode=dark]', $scope)} {
@content;
}
}
Expand Down Expand Up @@ -103,6 +111,7 @@
width: 4px;
height: 4px;
}

&::-webkit-scrollbar-thumb {
background-color: $color;
}
Expand Down

0 comments on commit 685f5fd

Please sign in to comment.