Skip to content

Commit

Permalink
Merge pull request #10700 from quarto-dev/revealjs/kbd-style
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv authored Sep 5, 2024
2 parents 4f41328 + 9e9a051 commit 7a0131d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
5 changes: 5 additions & 0 deletions news/changelog-1.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ All changes included in 1.6:
- ([#10328](https://github.com/quarto-dev/quarto-cli/issues/10328)): Interpret subcells as subfloats when subcap count matches subcell count.
- ([#10624](https://github.com/quarto-dev/quarto-cli/issues/10624)): Don't crash when proof environments are empty in `pdf`.

## `html` Format

- Fix `kbd` element styling on dark themes.

## `revealjs` Format

- Update to Reveal JS 5.1.0.
- Prevent empty SASS built css file to be included in header.
- Remove wrong `sourceMappingUrl` entry in SASS built css.
- ([#7715](https://github.com/quarto-dev/quarto-cli/issues/7715)): Revealjs don't support anymore special Pandoc syntax making BulletList in Blockquotes become incremental list. This was confusing and unexpected behavior. Supported syntax for incremental list is documented at <https://quarto.org/docs/presentations/revealjs/#incremental-lists>.
- ([#9742](https://github.com/quarto-dev/quarto-cli/issues/9742)): Links to cross-referenced images correctly works.
- ([#6012](https://github.com/quarto-dev/quarto-cli/issues/6012)): Add styling for `kbd` element in Revealjs slides.

## `typst` Format

Expand Down
6 changes: 5 additions & 1 deletion src/resources/formats/html/bootstrap/_bootstrap-rules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,11 @@ $indent: 1.2em;
kbd,
.kbd {
color: $body-color;
background-color: $gray-100;
@if (quarto-color.blackness($body-bg) > $code-block-theme-dark-threshhold) {
background-color: shift-color($gray-100, 70%);
} @else {
background-color: $gray-100;
}
border: 1px solid;
border-radius: 5px;
border-color: $table-border-color;
Expand Down
51 changes: 51 additions & 0 deletions src/resources/formats/revealjs/quarto.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ $body-bg: #fff !default;
$body-color: #222 !default;
$text-muted: lighten($body-color, 30%) !default;

// grey colors (like in bootstrap)
$gray-200: #e9ecef !default;
$gray-100: #f8f9fa !default;
$gray-900: #212529 !default;

// link colors
$primary: #2a76dd !default;
$link-color: $primary !default;
Expand Down Expand Up @@ -156,15 +161,48 @@ $overlayElementFgColor: 0, 0, 0 !default;

// -- END setting.scss --

// KBD variables
$kbd-padding-y: 0.4rem !default;
$kbd-padding-x: 0.4rem !default;
$kbd-font-size: $presentation-font-size-root !default;
$kbd-color: $body-color !default;
$kbd-bg: $gray-100 !default; // like in bootstrap style

/*-- scss:functions --*/

@function colorToRGB($color) {
@return "rgb(" + red($color) + ", " + green($color) + ", " + blue($color) +
")";
}

@function tint-color($color, $weight) {
@return mix(white, $color, $weight);
}

@function shade-color($color, $weight) {
@return mix(black, $color, $weight);
}

@function shift-color($color, $weight) {
@return if(
$weight > 0,
shade-color($color, $weight),
tint-color($color, -$weight)
);
}

/*-- scss:mixins --*/

@mixin shift_to_dark($property, $color) {
@if (
sass-color.blackness($backgroundColor) > $code-block-theme-dark-threshhold
) {
#{$property}: shift-color($color, 70%);
} @else {
#{$property}: $color;
}
}

// -- START setting.scss --

// Generates the presentation background, can be overridden
Expand Down Expand Up @@ -738,3 +776,16 @@ div.cell-output-display div.pagedtable-wrapper table.table {
.reveal .scrollable ol li:first-child:nth-last-child(n + 10) ~ li {
margin-left: 1em;
}

/* kbd rules */

kbd {
font-family: $font-family-monospace;
font-size: $kbd-font-size;
color: $kbd-color;
@include shift_to_dark("background-color", $kbd-bg);
border: 1px solid;
border-color: $code-block-border-color;
border-radius: 5px;
padding: $kbd-padding-y $kbd-padding-x;
}

0 comments on commit 7a0131d

Please sign in to comment.