Skip to content

Commit bee2789

Browse files
honzajavorekclaude
andcommitted
Leave selection colours to the browser, declare color-scheme instead
The unreadable selection came from Furo not declaring color-scheme, so browsers used the OS dark-mode selection on light pages. Declaring the active scheme lets the browser pick fitting native colours. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 09536af commit bee2789

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

‎docs/_static/custom.css‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,23 @@ body[data-theme="dark"] img.adaptive-image {
3232
}
3333

3434
/*
35-
Furo doesn't style text selection, so browsers use the system colour, which
36-
is dark blue on a light page when the OS is in dark mode. Selected text,
37-
including links, gets one high-contrast colour on a Pyvec tint. The sidebar
38-
is slate in both modes, so it always uses the dark variant.
35+
Furo doesn't declare color-scheme, so browsers follow the OS. On a light
36+
page with the OS in dark mode, the native text selection was dark blue
37+
and unreadable. Declare the active scheme, so the browser and OS pick
38+
fitting native colours for selection, scrollbars, and form controls.
39+
The sidebar is slate in both modes, so it's always dark.
3940
*/
40-
::selection {
41-
color: #000;
42-
background: #c7e7f7;
41+
body {
42+
color-scheme: light;
4343
}
4444

45-
body[data-theme="dark"] ::selection,
46-
.sidebar-drawer ::selection {
47-
color: #fff;
48-
background: #3b4f5a;
45+
body[data-theme="dark"],
46+
.sidebar-drawer {
47+
color-scheme: dark;
4948
}
5049

5150
@media (prefers-color-scheme: dark) {
52-
body:not([data-theme="light"]) ::selection {
53-
color: #fff;
54-
background: #3b4f5a;
51+
body:not([data-theme="light"]) {
52+
color-scheme: dark;
5553
}
5654
}

0 commit comments

Comments
 (0)