Skip to content

Commit f00a8b5

Browse files
feat: add dark_mode_navbar toggle icon tone (v1.3.1)
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 445809a commit f00a8b5

12 files changed

Lines changed: 104 additions & 14 deletions

File tree

CHANGELOG.adoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
88

99
Entries below are in **chronological order** by date: prior release, then the **2026-03-04** org creation and repository move, then the next release.
1010

11+
== [Unreleased]
12+
13+
== [1.3.1] - 2026-06-13
14+
15+
* *Toggle icon:* Playbook `site.keys.dark_mode_navbar` (`dark` | `light`) selects light-mode navbar tone for the theme toggle — dark top bar (Antora default, white icon) vs. light top bar (dark icon). Sets `meta[name=dm-navbar]` and `html[data-dm-navbar]`.
16+
1117
== [1.3.0] - 2026-06-13
1218

1319
* *npm:* First publish as `antora-dark-mode` (overlay transport: `supplemental-ui/` + `ui-modules/`). Deprecate legacy `antora-dark-theme` npm package name.
@@ -16,8 +22,6 @@ Entries below are in **chronological order** by date: prior release, then the **
1622

1723
link:changelog-details/2026-06-13%20-%20overlay-first%20install%20and%20ui-module.adoc[Detailed notes — 2026-06-13]
1824

19-
== [Unreleased]
20-
2125
== [1.2.0] - 2026-06-09
2226

2327
* *Split:* Repository renamed to `antora-dark-mode`; doc chrome (mast, header, layout, VCS icons) moved to link:https://github.com/antora-supplemental/valentus-theme[valentus-theme]. This package is dark mode only (`site-extra.css`, FOUC script, theme toggle).

docs/modules/guide/pages/configuration.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ The supplemental header and footer read optional playbook keys so you can brand
8181
| `title_bar_section`
8282
| component title
8383
| Browser tab middle segment; see `partials/head-title.hbs`.
84+
85+
| `dark_mode_navbar`
86+
| `dark`
87+
| Light-mode top bar tone for the theme toggle icon. `dark` — black navbar (Antora default UI); icon inherits the navbar foreground (white). `light` — light top bar; icon uses dark stroke (`#1a1a1a`). Sets `meta[name=dm-navbar]` and `html[data-dm-navbar]` for toggle CSS. Required for light header strips such as link:https://github.com/antora-supplemental/valentus-theme[valentus-theme].
8488
|===
8589

8690
Example—custom logo without overriding `partials/header-content.hbs`:

docs/modules/guide/pages/customization.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,41 @@ To change its position, modify the `ensureToggleButton()` function in `site-dark
8787
navbarEnd.appendChild(button);
8888
----
8989

90+
[[toggle-navbar-tone]]
91+
== Light-mode navbar tone (toggle icon color)
92+
93+
The default Antora UI uses a *dark* top bar in light mode, so the toggle icon inherits a light (white) stroke via `currentColor`.
94+
If your light-mode header is a *light* strip (for example link:https://github.com/antora-supplemental/valentus-theme[valentus-theme]), set the playbook key so the moon/sun icon stays visible:
95+
96+
[source,yaml]
97+
----
98+
site:
99+
keys:
100+
dark_mode_navbar: light
101+
----
102+
103+
Values:
104+
105+
* `dark` (default) — dark top bar in light mode; icon inherits navbar foreground (Antora default UI).
106+
* `light` — light top bar in light mode; icon uses dark stroke (`#1a1a1a`) and a subtle dark hover.
107+
108+
This emits `meta[name=dm-navbar]` from `partials/head-meta.hbs` and sets `html[data-dm-navbar]` before paint.
109+
Ui-module installs without the head partial can add the same meta tag in supplemental UI:
110+
111+
[source,html]
112+
----
113+
<meta name="dm-navbar" content="light">
114+
----
115+
116+
Or override in CSS:
117+
118+
[source,css]
119+
----
120+
html:not(.dark-theme) .theme-toggle {
121+
color: #1a1a1a;
122+
}
123+
----
124+
90125
== Custom Toggle Button
91126

92127
If you want to use your own toggle button markup, add an element with `id="theme-toggle"` anywhere in your page:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "antora-dark-mode",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Dark mode supplemental UI for Antora — slot-based overlay, toggle, FOUC prevention, and CSS overrides.",
55
"keywords": [
66
"antora",

supplemental-ui/css/site-extra.css

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,10 @@ html.dark-theme .home-link {
473473
color: #ffffff;
474474
}
475475

476-
/* Toggle button styles */
476+
/* Toggle button styles
477+
Light-mode navbar tone: playbook site.keys.dark_mode_navbar → meta[name=dm-navbar] → html[data-dm-navbar].
478+
dark (default): Antora default UI black top bar — inherit white icon from navbar.
479+
light: light top bar — dark icon; set dark_mode_navbar: light or meta content="light". */
477480
.theme-toggle {
478481
background: none;
479482
border: 0;
@@ -491,8 +494,16 @@ html.dark-theme .home-link {
491494
text-transform: none;
492495
}
493496

494-
.theme-toggle:hover {
495-
background-color: #e9ecef;
497+
html:not(.dark-theme):not([data-dm-navbar="light"]) .theme-toggle:hover {
498+
background-color: #1f2125;
499+
}
500+
501+
html[data-dm-navbar="light"]:not(.dark-theme) .theme-toggle {
502+
color: #1a1a1a;
503+
}
504+
505+
html[data-dm-navbar="light"]:not(.dark-theme) .theme-toggle:hover {
506+
background-color: rgba(0, 0, 0, 0.07);
496507
}
497508

498509
.theme-toggle .theme-icon {

supplemental-ui/js/site-dark-mode.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
if (toggle) toggle.blur();
121121
}
122122

123+
function toggleButtonClassName() {
124+
const useLightNavbarChrome = document.querySelector(".header.adt-header");
125+
if (useLightNavbarChrome) {
126+
return "navbar-item adt-header-icon-btn theme-toggle";
127+
}
128+
return "navbar-item theme-toggle";
129+
}
130+
123131
function ensureToggleButton() {
124132
const selector = document.getElementById("theme-selector");
125133
if (selector) {
@@ -141,7 +149,7 @@
141149

142150
const button = document.createElement("button");
143151
button.id = "theme-toggle";
144-
button.className = "navbar-item theme-toggle";
152+
button.className = toggleButtonClassName();
145153
button.type = "button";
146154
button.addEventListener("click", toggleTheme);
147155

supplemental-ui/partials/head-meta.hbs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site-extra.css">
2+
<meta name="dm-navbar" content="{{or (lookup site.keys 'dark_mode_navbar') 'dark'}}">
23
<script>
34
(function () {
5+
const dmNavbar = document.querySelector('meta[name="dm-navbar"]')
6+
if (dmNavbar && dmNavbar.content) {
7+
document.documentElement.dataset.dmNavbar = dmNavbar.content
8+
}
49
const MODE = 'antora-theme-mode'
510
const LEGACY = 'antora-theme'
611
function mode() {

ui-modules/packages/dark-mode/ui-module.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
id: "dark-mode",
33
name: "Antora dark mode",
4-
version: "1.3.0",
4+
version: "1.3.1",
55
type: "ui-module",
66
description: "Dark mode CSS, FOUC prevention, and navbar theme toggle. Slot-based overlay — does not replace theme partials.",
77
repository: "https://github.com/antora-supplemental/antora-dark-mode",

ui-modules/packages/dark-mode/ui/css/site-extra.css

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,10 @@ html.dark-theme .home-link {
473473
color: #ffffff;
474474
}
475475

476-
/* Toggle button styles */
476+
/* Toggle button styles
477+
Light-mode navbar tone: playbook site.keys.dark_mode_navbar → meta[name=dm-navbar] → html[data-dm-navbar].
478+
dark (default): Antora default UI black top bar — inherit white icon from navbar.
479+
light: light top bar — dark icon; set dark_mode_navbar: light or meta content="light". */
477480
.theme-toggle {
478481
background: none;
479482
border: 0;
@@ -491,8 +494,16 @@ html.dark-theme .home-link {
491494
text-transform: none;
492495
}
493496

494-
.theme-toggle:hover {
495-
background-color: #e9ecef;
497+
html:not(.dark-theme):not([data-dm-navbar="light"]) .theme-toggle:hover {
498+
background-color: #1f2125;
499+
}
500+
501+
html[data-dm-navbar="light"]:not(.dark-theme) .theme-toggle {
502+
color: #1a1a1a;
503+
}
504+
505+
html[data-dm-navbar="light"]:not(.dark-theme) .theme-toggle:hover {
506+
background-color: rgba(0, 0, 0, 0.07);
496507
}
497508

498509
.theme-toggle .theme-icon {

ui-modules/packages/dark-mode/ui/js/site-dark-mode.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
if (toggle) toggle.blur();
121121
}
122122

123+
function toggleButtonClassName() {
124+
const useLightNavbarChrome = document.querySelector(".header.adt-header");
125+
if (useLightNavbarChrome) {
126+
return "navbar-item adt-header-icon-btn theme-toggle";
127+
}
128+
return "navbar-item theme-toggle";
129+
}
130+
123131
function ensureToggleButton() {
124132
const selector = document.getElementById("theme-selector");
125133
if (selector) {
@@ -141,7 +149,7 @@
141149

142150
const button = document.createElement("button");
143151
button.id = "theme-toggle";
144-
button.className = "navbar-item theme-toggle";
152+
button.className = toggleButtonClassName();
145153
button.type = "button";
146154
button.addEventListener("click", toggleTheme);
147155

0 commit comments

Comments
 (0)