- Notifications
You must be signed in to change notification settings - Fork 4k
Description
Context
I'm creating a personal blog with mkdocs-material==9.5.14 and the built-in Blog plugin.
Bug description
If I set my palette as the following with a non-default primary color set in the default scheme, then this color isn't used by the social plugin when creating the social cards, it just uses the default.
theme: palette: - media: "(prefers-color-scheme)" toggle: icon: material/brightness-auto name: Switch to light mode - media: "(prefers-color-scheme: light)" scheme: default primary: black accent: orange toggle: icon: material/brightness-5 name: Switch to dark mode - media: "(prefers-color-scheme: dark)" scheme: slate toggle: icon: material/brightness-4 name: Switch to system preferenceIf I repeat the palette colors in the top item under palette, then these are used by the social plugin when creating a card.
theme: palette: - media: "(prefers-color-scheme)" primary: black accent: orange toggle: icon: material/brightness-auto name: Switch to light mode - media: "(prefers-color-scheme: light)" scheme: default primary: black accent: orange toggle: icon: material/brightness-5 name: Switch to dark mode - media: "(prefers-color-scheme: dark)" scheme: slate toggle: icon: material/brightness-4 name: Switch to system preferenceIf I move the media: "(prefers-color-scheme: light)" item to the top item, then the colors also will be used properly by the social plugin, without the need for repetition.
theme: palette: - media: "(prefers-color-scheme: light)" scheme: default primary: black accent: orange toggle: icon: material/brightness-5 name: Switch to dark mode - media: "(prefers-color-scheme)" toggle: icon: material/brightness-auto name: Switch to light mode - media: "(prefers-color-scheme: dark)" scheme: slate toggle: icon: material/brightness-4 name: Switch to system preferenceSuggested solutions
- When selecting the color scheme to socials, search for the media item with
schema: defaultand use those colors. The order of the list in the YAML won't matter with this solution. - Document the above behaviour in the docs - suggesting either repetition or making sure default scheme is the first item.
Related links
Reproduction
9.5.14-media-palette-unused-socials.zip
I've put in some commented sections so that anyone checking can try all of the light/dark mode suggestions in the docs and confirm this bug.
Steps to reproduce
Using the makefile on Linux...
make all(installs imaging dependencies and requirements into a virtual environment- Remove
- infofrom the plugins in mkdocs.yml - Activate venv with
source .venv/bin/activate make docs
Browser
No response
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction using the built-in info plugin.

