Skip to content

Commit 9e9a051

Browse files
committed
reveal, kbd - apply same logic as in bootstrap for dark theme
1 parent 36083ce commit 9e9a051

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

news/changelog-1.6.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ All changes included in 1.6:
1212
- ([#10328](https://github.com/quarto-dev/quarto-cli/issues/10328)): Interpret subcells as subfloats when subcap count matches subcell count.
1313
- ([#10624](https://github.com/quarto-dev/quarto-cli/issues/10624)): Don't crash when proof environments are empty in `pdf`.
1414

15+
## `html` Format
16+
17+
- Fix `kbd` element styling on dark themes.
18+
1519
## `revealjs` Format
1620

1721
- Update to Reveal JS 5.1.0.

src/resources/formats/revealjs/quarto.scss

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ $body-bg: #fff !default;
1818
$body-color: #222 !default;
1919
$text-muted: lighten($body-color, 30%) !default;
2020

21+
// grey colors (like in bootstrap)
22+
$gray-200: #e9ecef !default;
23+
$gray-100: #f8f9fa !default;
24+
$gray-900: #212529 !default;
25+
2126
// link colors
2227
$primary: #2a76dd !default;
2328
$link-color: $primary !default;
@@ -161,7 +166,7 @@ $kbd-padding-y: 0.4rem !default;
161166
$kbd-padding-x: 0.4rem !default;
162167
$kbd-font-size: $presentation-font-size-root !default;
163168
$kbd-color: $body-color !default;
164-
$kbd-bg: $body-bg !default;
169+
$kbd-bg: $gray-100 !default; // like in bootstrap style
165170

166171
/*-- scss:functions --*/
167172

@@ -170,8 +175,34 @@ $kbd-bg: $body-bg !default;
170175
")";
171176
}
172177

178+
@function tint-color($color, $weight) {
179+
@return mix(white, $color, $weight);
180+
}
181+
182+
@function shade-color($color, $weight) {
183+
@return mix(black, $color, $weight);
184+
}
185+
186+
@function shift-color($color, $weight) {
187+
@return if(
188+
$weight > 0,
189+
shade-color($color, $weight),
190+
tint-color($color, -$weight)
191+
);
192+
}
193+
173194
/*-- scss:mixins --*/
174195

196+
@mixin shift_to_dark($property, $color) {
197+
@if (
198+
sass-color.blackness($backgroundColor) > $code-block-theme-dark-threshhold
199+
) {
200+
#{$property}: shift-color($color, 70%);
201+
} @else {
202+
#{$property}: $color;
203+
}
204+
}
205+
175206
// -- START setting.scss --
176207

177208
// Generates the presentation background, can be overridden
@@ -752,7 +783,7 @@ kbd {
752783
font-family: $font-family-monospace;
753784
font-size: $kbd-font-size;
754785
color: $kbd-color;
755-
background-color: $kbd-bg;
786+
@include shift_to_dark("background-color", $kbd-bg);
756787
border: 1px solid;
757788
border-color: $code-block-border-color;
758789
border-radius: 5px;

0 commit comments

Comments
 (0)