Skip to content

Commit 66d4500

Browse files
committed
Fixed interference of social plugin and auto dark mode
1 parent cc78979 commit 66d4500

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

material/plugins/social/plugin.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ def on_config(self, config):
117117
if "palette" in theme:
118118
palette = theme["palette"]
119119

120-
# Use first palette, if multiple are defined
120+
# Find first palette that includes primary color definition
121121
if isinstance(palette, list):
122-
palette = palette[0]
122+
for p in palette:
123+
if "primary" in p and p["primary"]:
124+
palette = p
125+
break
123126

124127
# Set colors according to palette
125128
if "primary" in palette and palette["primary"]:

src/plugins/social/plugin.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ def on_config(self, config):
117117
if "palette" in theme:
118118
palette = theme["palette"]
119119

120-
# Use first palette, if multiple are defined
120+
# Find first palette that includes primary color definition
121121
if isinstance(palette, list):
122-
palette = palette[0]
122+
for p in palette:
123+
if "primary" in p and p["primary"]:
124+
palette = p
125+
break
123126

124127
# Set colors according to palette
125128
if "primary" in palette and palette["primary"]:

0 commit comments

Comments
 (0)