mirror of
https://github.com/primer/css.git
synced 2024-12-14 06:44:38 +03:00
Update color mode mixin to support 'auto'
This commit is contained in:
parent
fb8a46b495
commit
ea3d15daf0
@ -1,14 +1,26 @@
|
||||
// Allows CSS to be scoped to a specific color mode
|
||||
@mixin color-mode($mode) {
|
||||
@if $mode == light {
|
||||
:root,
|
||||
:root:not(data-color-mode),
|
||||
[data-color-mode="light"] {
|
||||
@content;
|
||||
}
|
||||
|
||||
[data-color-mode="auto"] {
|
||||
@media (prefers-color-scheme: light) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
@else if $mode == dark {
|
||||
[data-color-mode="dark"] {
|
||||
@content;
|
||||
}
|
||||
|
||||
[data-color-mode="auto"] {
|
||||
@media (prefers-color-scheme: dark) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user