Skip to content

Commit

Permalink
Add auto dark/light mode in docs (#177)
Browse files Browse the repository at this point in the history
* github/workflows: Set python version to 3.10

* docs: Update mkdocs-material and mike deps

* mkdocs: Enable auto dark/light mode
  • Loading branch information
MusicDin authored Mar 9, 2024
1 parent e55a9f2 commit ad7ca28
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: "3.10"

- name: Deploy documentation
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: "3.10"

- name: Install virtualenv
run: |
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
jinja2~=3.1
markdown~=3.3
mkdocs~=1.5,>=1.5.3
mkdocs-material~=9.4
mkdocs-material~=9.5
mkdocs-material-extensions~=1.3
mkdocs-minify-plugin~=0.6
mkdocs-redirects~=1.0
pygments~=2.16
pymdown-extensions~=10.2
mike~=1.1
mike~=2.0
30 changes: 19 additions & 11 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ theme:
text: Ubuntu

palette:
- scheme: default
- media: "(prefers-color-scheme)"
toggle:
icon: material/weather-night
name: Switch to dark mode
- scheme: slate
icon: material/brightness-auto
name: Switch to light mode
- media: "(prefers-color-scheme: light)"
scheme: default
toggle:
icon: material/weather-sunny
name: Switch to light mode
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/weather-night
name: Switch to system preference

features:
- content.code.annotate
Expand Down Expand Up @@ -89,15 +95,17 @@ markdown_extensions:
# Emoji
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg # Page tree
emoji_generator: !!python/name:material.extensions.emoji.to_svg
# Page tree

# - pymdownx.highlight:
# linenums: true
# anchor_linenums: true
# linenums_style: pymdownx-inline

# - pymdownx.highlight:
# linenums: true
# anchor_linenums: true
# linenums_style: pymdownx-inline

- toc:
permalink: "🔗︎" # Link symbol
permalink: "🔗︎" # Link symbol
permalink_title: Anchor link

nav:
Expand Down

0 comments on commit ad7ca28

Please sign in to comment.