mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Improved interop of social plugin with other themes
This commit is contained in:
parent
324ccdb737
commit
6a761ed418
@ -408,7 +408,7 @@ class SocialPlugin(BasePlugin[SocialConfig]):
|
|||||||
return Image.open(path).convert("RGBA")
|
return Image.open(path).convert("RGBA")
|
||||||
|
|
||||||
# Handle icons
|
# Handle icons
|
||||||
icon = theme["icon"] or {}
|
icon = theme.get("icon") or {}
|
||||||
if "logo" in icon and icon["logo"]:
|
if "logo" in icon and icon["logo"]:
|
||||||
logo = icon["logo"]
|
logo = icon["logo"]
|
||||||
else:
|
else:
|
||||||
@ -448,13 +448,7 @@ class SocialPlugin(BasePlugin[SocialConfig]):
|
|||||||
def _load_font(self, config):
|
def _load_font(self, config):
|
||||||
name = self.config.cards_layout_options.get("font_family")
|
name = self.config.cards_layout_options.get("font_family")
|
||||||
if not name:
|
if not name:
|
||||||
|
name = config.theme.get("font", {}).get("text", "Roboto")
|
||||||
# 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"
|
|
||||||
|
|
||||||
# Resolve relevant fonts
|
# Resolve relevant fonts
|
||||||
font = {}
|
font = {}
|
||||||
|
@ -408,7 +408,7 @@ class SocialPlugin(BasePlugin[SocialConfig]):
|
|||||||
return Image.open(path).convert("RGBA")
|
return Image.open(path).convert("RGBA")
|
||||||
|
|
||||||
# Handle icons
|
# Handle icons
|
||||||
icon = theme["icon"] or {}
|
icon = theme.get("icon") or {}
|
||||||
if "logo" in icon and icon["logo"]:
|
if "logo" in icon and icon["logo"]:
|
||||||
logo = icon["logo"]
|
logo = icon["logo"]
|
||||||
else:
|
else:
|
||||||
@ -448,13 +448,7 @@ class SocialPlugin(BasePlugin[SocialConfig]):
|
|||||||
def _load_font(self, config):
|
def _load_font(self, config):
|
||||||
name = self.config.cards_layout_options.get("font_family")
|
name = self.config.cards_layout_options.get("font_family")
|
||||||
if not name:
|
if not name:
|
||||||
|
name = config.theme.get("font", {}).get("text", "Roboto")
|
||||||
# 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"
|
|
||||||
|
|
||||||
# Resolve relevant fonts
|
# Resolve relevant fonts
|
||||||
font = {}
|
font = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user