-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Respect user's preferred theme even when JavaScript isn't enabled (
#169)
- Loading branch information
Showing
9 changed files
with
81 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
// https://codyhouse.co/ds/globals/colors | ||
// https://github.com/dracula/dracula-theme/ | ||
|
||
[data-theme="dark"] { | ||
@mixin dark-theme { | ||
--theme-name: "dark"; | ||
@include defineColorHSL(--color-primary, $primaryColorDarkH, $primaryColorDarkS, $primaryColorDarkL); | ||
@include defineColorHSL(--color-bg, 231, 14%, 10%); // 0% | ||
@include defineColorHSL(--color-contrast-lower, 230, 8%, 15%); // 8% | ||
@include defineColorHSL(--color-contrast-low, 240, 2%, 25%); // 25% | ||
@include defineColorHSL(--color-contrast-medium, 80, 1%, 50%); // 60% | ||
@include defineColorHSL(--color-contrast-high, 69, 4%, 68%); // 85% | ||
@include defineColorHSL(--color-contrast-higher, 60, 10%, 80%); // 100% | ||
.theme-icon-light { | ||
display: none; | ||
} | ||
.theme-icon-dark { | ||
display: inline-block; | ||
} | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
:root:not([data-theme]) | ||
{ | ||
@include dark-theme; | ||
} | ||
} | ||
|
||
@if $defaultTheme == dark { | ||
:root { | ||
@include dark-theme; | ||
} | ||
} | ||
@else { | ||
:root[data-theme="dark"] { | ||
@include dark-theme; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,36 @@ | ||
// https://codyhouse.co/ds/globals/colors | ||
|
||
:root { | ||
@mixin light-theme { | ||
--theme-name: "light"; | ||
@include defineColorHSL(--color-primary, $primaryColorLightH, $primaryColorLightS, $primaryColorLightL); | ||
@include defineColorHSL(--color-bg, 0, 0%, 100%); | ||
@include defineColorHSL(--color-contrast-lower, 0, 0%, 95%); | ||
@include defineColorHSL(--color-contrast-low, 240, 1%, 83%); | ||
@include defineColorHSL(--color-contrast-medium, 240, 1%, 48%); | ||
@include defineColorHSL(--color-contrast-high, 240, 4%, 20%); | ||
@include defineColorHSL(--color-contrast-higher, 240, 8%, 12%); | ||
.theme-icon-light { | ||
display: inline-block; | ||
} | ||
.theme-icon-dark { | ||
display: none; | ||
} | ||
} | ||
|
||
@media (prefers-color-scheme: light) { | ||
:root:not([data-theme]) | ||
{ | ||
@include light-theme; | ||
} | ||
} | ||
|
||
@if $defaultTheme == light { | ||
:root { | ||
@include light-theme; | ||
} | ||
} | ||
@else { | ||
:root[data-theme="light"] { | ||
@include light-theme; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...leSite/resources/_gen/assets/scss/scss/main.scss_a899b346ffc3a4bc65b84e40528dea51.content
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
exampleSite/resources/_gen/assets/scss/scss/main.scss_a899b346ffc3a4bc65b84e40528dea51.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"Target":"css/meme.min.927661e0387b38c89693e1e88b77f76f95dbe58e5082bf462891be5a6d1898db.css","MediaType":"text/css","Data":{"Integrity":"sha256-knZh4Dh7OMiWk+Hoi3f3b5Xb5Y5Qgr9GKJG+Wm0YmNs="}} | ||
{"Target":"css/meme.min.d6acf9d8381fd38d6ee816dfceb3a5a0d7826360238525a707812d09d647082b.css","MediaType":"text/css","Data":{"Integrity":"sha256-1qz52Dgf041u6BbfzrOloNeCY2AjhSWnB4EtCdZHCCs="}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters