Skip to content

Commit 522fbb0

Browse files
demakoffaduh95
authored andcommitted
doc: make theme consistent across api and other docs
Since website based on 2 different repos, there was an inconsistency in theme selection, so we had 2 independant theme props. Now only one stored in local storage is a single source of truth PR-URL: #50877 Reviewed-By: Claudio Wunder <cwunder@gnome.org> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
1 parent 1486465 commit 522fbb0

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

BUILDING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,12 @@ make docopen
456456
This will open a file URL to a one-page version of all the browsable HTML
457457
documents using the default browser.
458458

459+
```bash
460+
make docclean
461+
```
462+
463+
This will clean previously built doc.
464+
459465
To test if Node.js was built correctly:
460466

461467
```bash

doc/api_assets/api.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
{
44
function setupTheme() {
5-
const kCustomPreference = 'customDarkTheme';
6-
const userSettings = sessionStorage.getItem(kCustomPreference);
5+
const storedTheme = localStorage.getItem('theme');
76
const themeToggleButton = document.getElementById('theme-toggle-btn');
87

9-
if (userSettings === null && window.matchMedia) {
8+
// Follow operating system theme preference
9+
if (storedTheme === null && window.matchMedia) {
1010
const mq = window.matchMedia('(prefers-color-scheme: dark)');
1111

1212
if ('onchange' in mq) {
@@ -28,16 +28,16 @@
2828
if (mq.matches) {
2929
document.documentElement.classList.add('dark-mode');
3030
}
31-
} else if (userSettings === 'true') {
31+
} else if (storedTheme === 'dark') {
3232
document.documentElement.classList.add('dark-mode');
3333
}
3434

3535
if (themeToggleButton) {
3636
themeToggleButton.hidden = false;
3737
themeToggleButton.addEventListener('click', function() {
38-
sessionStorage.setItem(
39-
kCustomPreference,
40-
document.documentElement.classList.toggle('dark-mode'),
38+
localStorage.setItem(
39+
'theme',
40+
document.documentElement.classList.toggle('dark-mode') ? 'dark' : 'light',
4141
);
4242
});
4343
}

doc/contributing/collaborator-guide.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,10 @@ The TSC serves as the final arbiter where required.
532532
[build](https://github.com/nodejs/build/issues) repositories, open new
533533
issues. Run a new CI any time someone pushes new code to the pull request.
534534
4. Check that the commit message adheres to [commit message guidelines][].
535-
5. Add all necessary [metadata](#metadata) to commit messages before landing. If
536-
you are unsure exactly how to format the commit messages, use the commit log
537-
as a reference. See [this commit][commit-example] as an example.
535+
5. Add all necessary [metadata][git-node-metadata] to commit messages before
536+
landing. If you are unsure exactly how to format the commit messages, use
537+
the commit log as a reference. See [this commit][commit-example] as an
538+
example.
538539

539540
For pull requests from first-time contributors, be
540541
[welcoming](#welcoming-first-time-contributors). Also, verify that their git

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy