Skip to content

feature (theme): add light/dark mode toggle across all mkdocs configs#939

Open
AarishShah wants to merge 3 commits into
OWASP:masterfrom
AarishShah:feature/dark-mode-toggle
Open

feature (theme): add light/dark mode toggle across all mkdocs configs#939
AarishShah wants to merge 3 commits into
OWASP:masterfrom
AarishShah:feature/dark-mode-toggle

Conversation

@AarishShah

Copy link
Copy Markdown

Summary

Adds a light/dark mode toggle to the OWASP Top 10 documentation site by configuring the palette option in the MkDocs Material theme.

Changes

Added a palette block to:

  • mkdocs.yml
  • 2021/mkdocs.yml
  • 2025/mkdocs.yml

Two schemes:

  • default: light mode with a ☀️ toggle to switch to dark
  • slate: dark mode with a 🌙 toggle to switch to light

No dependencies added.

Reason

The OWASP Top 10 site currently has no dark mode. The MkDocs Material theme
supports this natively with a simple config change which has been applied.

Testing

Tested locally:

  • 2021/: python -m mkdocs serve from 2021/ directory, all language builds passed
  • 2025/: python -m mkdocs serve from 2025/ directory, English build passed
  • Zero new errors introduced

Comment thread 2025/mkdocs.yml
AarishShah and others added 2 commits May 9, 2026 23:47
Integrated system preference detection and manual toggle across all project versions.

Co-authored-by: DanielYang59 <DanielYang59@users.noreply.github.com>
@AarishShah

Copy link
Copy Markdown
Author

Thanks for the suggestion, @DanielYang59 I pulled the idea in, just had to tweak the logic a bit to fix a bug with the manual overrides. Pushed the fix to all three site versions (Root, 2021 & 2025) and added you as a co-author on the commit so you get credit. Appreciate the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants