Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: make theme consistent across api and other docs (from nodejs.org repo) #50877

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ make docopen
This will open a file URL to a one-page version of all the browsable HTML
documents using the default browser.

```bash
make docclean
```

This will clean previously built doc.

To test if Node.js was built correctly:

```bash
Expand Down
14 changes: 7 additions & 7 deletions doc/api_assets/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

{
function setupTheme() {
const kCustomPreference = 'customDarkTheme';
const userSettings = sessionStorage.getItem(kCustomPreference);
const storedTheme = localStorage.getItem('theme');
ovflowd marked this conversation as resolved.
Show resolved Hide resolved
const themeToggleButton = document.getElementById('theme-toggle-btn');

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

if ('onchange' in mq) {
Expand All @@ -28,16 +28,16 @@
if (mq.matches) {
document.documentElement.classList.add('dark-mode');
}
} else if (userSettings === 'true') {
} else if (storedTheme === 'dark') {
document.documentElement.classList.add('dark-mode');
}

if (themeToggleButton) {
themeToggleButton.hidden = false;
themeToggleButton.addEventListener('click', function() {
sessionStorage.setItem(
kCustomPreference,
document.documentElement.classList.toggle('dark-mode'),
localStorage.setItem(
'theme',
document.documentElement.classList.toggle('dark-mode') ? 'dark' : 'light',
);
});
}
Expand Down
7 changes: 4 additions & 3 deletions doc/contributing/collaborator-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,10 @@ The TSC serves as the final arbiter where required.
[build](https://github.com/nodejs/build/issues) repositories, open new
issues. Run a new CI any time someone pushes new code to the pull request.
4. Check that the commit message adheres to [commit message guidelines][].
5. Add all necessary [metadata](#metadata) to commit messages before landing. If
you are unsure exactly how to format the commit messages, use the commit log
as a reference. See [this commit][commit-example] as an example.
5. Add all necessary [metadata][git-node-metadata] to commit messages before
landing. If you are unsure exactly how to format the commit messages, use
the commit log as a reference. See [this commit][commit-example] as an
example.

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