Skip to content

Commit a012b8a

Browse files
committed
fix(brand): Map typography.link.color to $link-color-dark too
1 parent aaed92a commit a012b8a

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

shiny/ui/_theme_brand.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -65,45 +65,45 @@ def __str__(self):
6565
"""
6666

6767
# TODO: test that these Sass variables exist in Bootstrap
68-
typography_map: dict[str, dict[str, str]] = {
68+
typography_map: dict[str, dict[str, list[str]]] = {
6969
"base": {
70-
"family": "font-family-base",
71-
"size": "font-size-base",
72-
"line_height": "line-height-base",
73-
"weight": "font-weight-base",
70+
"family": ["font-family-base"],
71+
"size": ["font-size-base"],
72+
"line_height": ["line-height-base"],
73+
"weight": ["font-weight-base"],
7474
},
7575
"headings": {
76-
"family": "headings-font-family",
77-
"line_height": "headings-line-height",
78-
"weight": "headings-font-weight",
79-
"color": "headings-color",
80-
"style": "headings-style",
76+
"family": ["headings-font-family"],
77+
"line_height": ["headings-line-height"],
78+
"weight": ["headings-font-weight"],
79+
"color": ["headings-color"],
80+
"style": ["headings-style"],
8181
},
8282
"monospace": {
83-
"family": "font-family-monospace",
84-
"size": "code-font-size",
85-
"weight": "code-font-weight",
83+
"family": ["font-family-monospace"],
84+
"size": ["code-font-size"],
85+
"weight": ["code-font-weight"],
8686
},
8787
"monospace_inline": {
88-
"family": "font-family-monospace-inline",
89-
"color": "code-color",
90-
"background_color": "code-bg",
91-
"size": "code-inline-font-size",
92-
"weight": "code-inline-font-weight",
88+
"family": ["font-family-monospace-inline"],
89+
"color": ["code-color"],
90+
"background_color": ["code-bg"],
91+
"size": ["code-inline-font-size"],
92+
"weight": ["code-inline-font-weight"],
9393
},
9494
"monospace_block": {
95-
"family": "font-family-monospace-block",
96-
"line_height": "pre-line-height",
97-
"color": "pre-color",
98-
"background_color": "pre-bg",
99-
"weight": "code-block-font-weight",
100-
"size": "code-block-font-size",
95+
"family": ["font-family-monospace-block"],
96+
"line_height": ["pre-line-height"],
97+
"color": ["pre-color"],
98+
"background_color": ["pre-bg"],
99+
"weight": ["code-block-font-weight"],
100+
"size": ["code-block-font-size"],
101101
},
102102
"link": {
103-
"background_color": "link-bg",
104-
"color": "link-color",
105-
"weight": "link-weight",
106-
"decoration": "link-decoration",
103+
"background_color": ["link-bg"],
104+
"color": ["link-color", "link-color-dark"],
105+
"weight": ["link-weight"],
106+
"decoration": ["link-decoration"],
107107
},
108108
}
109109
"""Maps brand.typography fields to corresponding Bootstrap Sass variables"""
@@ -239,14 +239,14 @@ def __init__(
239239

240240
for typ_field_key, typ_field_value in typ_value.items():
241241
if typ_field_key in typography_map[typ_field]:
242-
typo_sass_var = typography_map[typ_field][typ_field_key]
243-
244242
if typ_field == "base" and typ_field_key == "size":
245243
typ_field_value = str(
246244
maybe_convert_font_size_to_rem(typ_field_value)
247245
)
248246

249-
sass_vars_typography[typo_sass_var] = typ_field_value
247+
typo_sass_vars = typography_map[typ_field][typ_field_key]
248+
for typo_sass_var in typo_sass_vars:
249+
sass_vars_typography[typo_sass_var] = typ_field_value
250250
elif raise_for_unmapped_vars:
251251
raise ThemeBrandUnmappedFieldError(
252252
f"typography.{typ_field}.{typ_field_key}"

0 commit comments

Comments
 (0)