Skip to content

Commit 62523eb

Browse files
authored
fix: More dark mode fixes (ietf-tools#5852)
* fix: Correctly indicate "auto" theme is default * fix: .pnp.js changes were missing * fix: Use a "-subtle" background color for the menu bar Because those change correctly with theme changes. That the non-"-subtle" ones may be a bs5 bug, but enough people complained about the yellow background in dev mode in dark mode that this change may be worth it. * fix: Try and recolor black colors in SVGs for dark mode * Apply suggestions from @martinthomson
1 parent e3a0f47 commit 62523eb

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

.pnp.cjs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ietf/static/css/document_html_txt.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,4 +450,19 @@ section > p, section > dl.references > dd {
450450
* doesn't break words at '/' like other browsers. */
451451
overflow-wrap: break-word;
452452
}
453+
454+
/* From https://github.com/martinthomson/rfc-css/blob/main/rfc.css */
455+
/* SVG Trick: a prefix match works because only black and white are allowed */
456+
svg :is([stroke="black"], [stroke^="#000"]) {
457+
stroke: var(--bs-body-color);
458+
}
459+
svg :is([stroke="white"], [stroke^="#fff"]) {
460+
stroke: var(--bs-body-bg);
461+
}
462+
svg :is([fill="black"], [fill^="#000"], :not([fill])) {
463+
fill: var(--bs-body-color);
464+
}
465+
svg :is([fill="white"], [fill^="#fff"]) {
466+
fill: var(--bs-body-bg);
467+
}
453468
}

ietf/static/js/theme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
(() => {
88
"use strict";
99

10-
const storedTheme = localStorage.getItem("theme");
10+
const storedTheme = localStorage.getItem("theme") || "auto";
1111

1212
const getPreferredTheme = () => {
1313
if (storedTheme) {

ietf/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
data-group-menu-data-url="{% url 'ietf.group.views.group_menu_data' %}">
3636
{% analytical_body_top %}
3737
<a class="visually-hidden visually-hidden-focusable" href="#content">Skip to main content</a>
38-
<nav class="navbar navbar-expand-lg fixed-top {% if server_mode and server_mode != "production" %}bg-warning navbar-light{% else %}navbar-dark bg-secondary{% endif %}">
38+
<nav class="navbar navbar-expand-lg fixed-top {% if server_mode and server_mode != "production" %}bg-danger-subtle navbar-light{% else %}navbar-dark bg-secondary{% endif %}">
3939
<div class="container-fluid">
4040
<a class="navbar-brand" href="/">
4141
<img alt="IETF Logo" class="me-2"

0 commit comments

Comments
 (0)