From 66d450009db8255b3d485654c1436a2845a3ae78 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Tue, 19 Mar 2024 11:11:08 +0800 Subject: [PATCH] Fixed interference of social plugin and auto dark mode --- material/plugins/social/plugin.py | 7 +++++-- src/plugins/social/plugin.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/material/plugins/social/plugin.py b/material/plugins/social/plugin.py index 40b3d07be..917454a62 100644 --- a/material/plugins/social/plugin.py +++ b/material/plugins/social/plugin.py @@ -117,9 +117,12 @@ class SocialPlugin(BasePlugin[SocialConfig]): if "palette" in theme: palette = theme["palette"] - # Use first palette, if multiple are defined + # Find first palette that includes primary color definition 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 if "primary" in palette and palette["primary"]: diff --git a/src/plugins/social/plugin.py b/src/plugins/social/plugin.py index 40b3d07be..917454a62 100644 --- a/src/plugins/social/plugin.py +++ b/src/plugins/social/plugin.py @@ -117,9 +117,12 @@ class SocialPlugin(BasePlugin[SocialConfig]): if "palette" in theme: palette = theme["palette"] - # Use first palette, if multiple are defined + # Find first palette that includes primary color definition 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 if "primary" in palette and palette["primary"]: