Skip to content

Commit 5ff5a88

Browse files
committed
Define colours based on theme rather than colour scheme
Additionally, uses the `light-dark` function to set colours based on the active colour scheme instead of having to manually select it.
1 parent 6a9b7db commit 5ff5a88

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/base.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
}
1313

1414
:root[data-scheme="light"] {
15-
--bg-colour: hsl(0, 0%, 100%);
16-
--text-colour: hsl(0, 0%, 0%);
17-
1815
color-scheme: light;
1916
}
2017

2118
:root[data-scheme="dark"] {
22-
--bg-colour: hsl(0, 0%, 10%);
23-
--text-colour: hsl(0, 0%, 100%);
24-
2519
color-scheme: dark;
2620
}
2721

22+
:root,
23+
:root[data-theme="normal"] {
24+
--bg-colour: light-dark(hsl(0, 0%, 100%), hsl(0, 0%, 10%));
25+
--text-colour: light-dark(hsl(0, 0%, 0%), hsl(0, 0%, 100%));
26+
}
27+
2828
:root {
2929
font-family: var(--font-family);
3030

src/index/style.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
@use "../base/dimensions";
22

33
:root,
4-
:root[data-scheme="light"] {
5-
--border-colour: hsl(0, 0%, 0%);
6-
}
7-
8-
:root[data-scheme="dark"] {
9-
--border-colour: hsl(0, 0%, 100%);
4+
:root[data-theme="normal"] {
5+
--border-colour: light-dark(hsl(0, 0%, 0%), hsl(0, 0%, 100%));
106
}
117

128
body {

0 commit comments

Comments
 (0)