1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-14 10:57:41 +01:00

Fixed interference of social plugin and auto dark mode

This commit is contained in:
squidfunk 2024-03-19 11:11:08 +08:00
parent cc78979185
commit 66d450009d
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
2 changed files with 10 additions and 4 deletions

View File

@ -117,9 +117,12 @@ class SocialPlugin(BasePlugin[SocialConfig]):
if "palette" in theme: if "palette" in theme:
palette = theme["palette"] palette = theme["palette"]
# Use first palette, if multiple are defined # Find first palette that includes primary color definition
if isinstance(palette, list): if isinstance(palette, list):
palette = palette[0] for p in palette:
if "primary" in p and p["primary"]:
palette = p
break
# Set colors according to palette # Set colors according to palette
if "primary" in palette and palette["primary"]: if "primary" in palette and palette["primary"]:

View File

@ -117,9 +117,12 @@ class SocialPlugin(BasePlugin[SocialConfig]):
if "palette" in theme: if "palette" in theme:
palette = theme["palette"] palette = theme["palette"]
# Use first palette, if multiple are defined # Find first palette that includes primary color definition
if isinstance(palette, list): if isinstance(palette, list):
palette = palette[0] for p in palette:
if "primary" in p and p["primary"]:
palette = p
break
# Set colors according to palette # Set colors according to palette
if "primary" in palette and palette["primary"]: if "primary" in palette and palette["primary"]: