Skip to content

Commit a35f3a8

Browse files
authored
fix(brand): Apply monospace-inline and monospace-block font family (#1762)
1 parent 415ced0 commit a35f3a8

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [UNRELEASED]
99

10+
### Bug fixes
11+
12+
* Branded theming via `ui.Theme.from_brand()` now correctly applies monospace inline and block font family choices. (#1762)
1013

1114

1215
## [1.2.0] - 2024-10-29

shiny/ui/_theme_brand.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,10 @@ def _add_sass_ensure_variables(self):
392392
"added variables",
393393
**{
394394
"code-font-weight": None,
395+
"font-family-monospace-inline": None,
395396
"code-inline-font-weight": None,
396397
"code-inline-font-size": None,
398+
"font-family-monospace-block": None,
397399
"code-block-font-weight": None,
398400
"code-block-font-size": None,
399401
"code-block-line-height": None,
@@ -481,23 +483,25 @@ def _add_sass_brand_rules(self):
481483
// *---- brand: brand rules to augment Bootstrap rules ----* //
482484
// https://github.com/twbs/bootstrap/blob/5c2f2e7e/scss/_root.scss#L82
483485
:root {
484-
--#{$prefix}link-bg: #{$link-bg};
485-
--#{$prefix}link-weight: #{$link-weight};
486+
--#{$prefix}link-bg: #{$link-bg};
487+
--#{$prefix}link-weight: #{$link-weight};
486488
}
487489
// https://github.com/twbs/bootstrap/blob/5c2f2e7e/scss/_reboot.scss#L244
488490
a {
489-
background-color: var(--#{$prefix}link-bg);
490-
font-weight: var(--#{$prefix}link-weight);
491+
background-color: var(--#{$prefix}link-bg);
492+
font-weight: var(--#{$prefix}link-weight);
491493
}
492494
code {
493-
font-weight: $code-font-weight;
495+
font-weight: $code-font-weight;
494496
}
495-
code {
497+
code:not(pre > code) {
498+
font-family: $font-family-monospace-inline;
496499
font-weight: $code-inline-font-weight;
497500
font-size: $code-inline-font-size;
498501
}
499502
// https://github.com/twbs/bootstrap/blob/30e01525/scss/_reboot.scss#L287
500503
pre {
504+
font-family: $font-family-monospace-block;
501505
font-weight: $code-block-font-weight;
502506
font-size: $code-block-font-size;
503507
line-height: $code-block-line-height;

0 commit comments

Comments
 (0)