Skip to content

Commit

Permalink
Improved interop of social plugin with other themes
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Apr 17, 2024
1 parent 324ccdb commit 6a761ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
10 changes: 2 additions & 8 deletions material/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def _load_logo(self, config):
return Image.open(path).convert("RGBA")

# Handle icons
icon = theme["icon"] or {}
icon = theme.get("icon") or {}
if "logo" in icon and icon["logo"]:
logo = icon["logo"]
else:
Expand Down Expand Up @@ -448,13 +448,7 @@ def _load_logo_svg(self, path, fill = None):
def _load_font(self, config):
name = self.config.cards_layout_options.get("font_family")
if not name:

# Retrieve from theme (default: Roboto)
theme = config.theme
if isinstance(theme["font"], dict) and "text" in theme["font"]:
name = theme["font"]["text"]
else:
name = "Roboto"
name = config.theme.get("font", {}).get("text", "Roboto")

# Resolve relevant fonts
font = {}
Expand Down
10 changes: 2 additions & 8 deletions src/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def _load_logo(self, config):
return Image.open(path).convert("RGBA")

# Handle icons
icon = theme["icon"] or {}
icon = theme.get("icon") or {}
if "logo" in icon and icon["logo"]:
logo = icon["logo"]
else:
Expand Down Expand Up @@ -448,13 +448,7 @@ def _load_logo_svg(self, path, fill = None):
def _load_font(self, config):
name = self.config.cards_layout_options.get("font_family")
if not name:

# Retrieve from theme (default: Roboto)
theme = config.theme
if isinstance(theme["font"], dict) and "text" in theme["font"]:
name = theme["font"]["text"]
else:
name = "Roboto"
name = config.theme.get("font", {}).get("text", "Roboto")

# Resolve relevant fonts
font = {}
Expand Down

0 comments on commit 6a761ed

Please sign in to comment.