@@ -58,8 +58,17 @@ class SocialPluginConfig(Config):
58
58
# Options for social cards
59
59
cards = opt .Type (bool , default = True )
60
60
cards_dir = opt .Type (str , default = "assets/images/social" )
61
- cards_color = opt .Type (dict , default = dict ())
62
- cards_font = opt .Optional (opt .Type (str ))
61
+ cards_layout_options = opt .Type (dict , default = {})
62
+
63
+ # Deprecated options
64
+ cards_color = opt .Deprecated (
65
+ message =
66
+ "Deprecated, use 'cards_layout_options.background_color' "
67
+ "and 'cards_layout_options.color' with 'default' layout"
68
+ )
69
+ cards_font = opt .Deprecated (
70
+ message = "Deprecated, use 'cards_layout_options.font_family'"
71
+ )
63
72
64
73
# -----------------------------------------------------------------------------
65
74
@@ -76,6 +85,24 @@ def on_config(self, config):
76
85
if not self .config .cards :
77
86
return
78
87
88
+ # Move color options
89
+ if "cards_color" in self .config :
90
+
91
+ # Move background color to new option
92
+ value = self .config .cards_color .get ("fill" )
93
+ if value :
94
+ self .config .cards_layout_options ["background_color" ] = value
95
+
96
+ # Move color to new option
97
+ value = self .config .cards_color .get ("text" )
98
+ if value :
99
+ self .config .cards_layout_options ["color" ] = value
100
+
101
+ # Move font family to new option
102
+ if "cards_font" in self .config :
103
+ value = self .config .cards_font
104
+ self .config .cards_layout_options ["font_family" ] = value
105
+
79
106
# Check if required dependencies are installed
80
107
if not dependencies :
81
108
log .error (
@@ -111,7 +138,13 @@ def on_config(self, config):
111
138
self .color = colors .get (primary , self .color )
112
139
113
140
# Retrieve color overrides
114
- self .color = { ** self .color , ** self .config .cards_color }
141
+ self .color = {
142
+ ** self .color ,
143
+ ** {
144
+ "fill" : self .config .cards_layout_options .get ("background_color" ),
145
+ "text" : self .config .cards_layout_options .get ("color" )
146
+ }
147
+ }
115
148
116
149
# Retrieve custom_dir path
117
150
for user_config in config .user_configs :
@@ -406,7 +439,7 @@ def _load_logo_svg(self, path, fill = None):
406
439
407
440
# Retrieve font
408
441
def _load_font (self , config ):
409
- name = self .config .cards_font
442
+ name = self .config .cards_layout_options . get ( "font_family" )
410
443
if not name :
411
444
412
445
# Retrieve from theme (default: Roboto)
0 commit comments