Skip to content

Commit 0c92ce4

Browse files
authored
Merge pull request #11963 from quarto-dev/callout-title-color
2 parents 9359983 + 9ae277c commit 0c92ce4

File tree

8 files changed

+59
-19
lines changed

8 files changed

+59
-19
lines changed

news/changelog-1.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All changes included in 1.7:
88
- ([#11580](https://github.com/quarto-dev/quarto-cli/issues/11580)): Fix regression with documents containing `categories` fields that are not strings.
99
- ([#11752](https://github.com/quarto-dev/quarto-cli/issues/11752)): Fix regression with non-alphanumeric characters in `categories` preventing correct filtering of listing.
1010
- ([#11561](https://github.com/quarto-dev/quarto-cli/issues/11561)): Fix a regression with `$border-color` that impacted, callouts borders, tabset borders, and table borders of the defaults themes. `$border-color` is now correctly a mixed of `$body-color` and `$body-bg` even for the default theme.
11+
- ([#11943](https://github.com/quarto-dev/quarto-cli/issues/11943)): Fix callout title color on dark theme in revealjs following Revealjs update in quarto 1.6.
1112

1213
## YAML validation
1314

package/src/common/patches/revealjs-theme-0001-dracula.patch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/src/resources/formats/revealjs/themes/dracula.scss b/src/resources/formats/revealjs/themes/dracula.scss
2-
index 5330fbc1b..45498dd41 100644
2+
index 5330fbc1b..fe068d9a8 100644
33
--- a/src/resources/formats/revealjs/themes/dracula.scss
44
+++ b/src/resources/formats/revealjs/themes/dracula.scss
5-
@@ -1,106 +1,88 @@
5+
@@ -1,106 +1,90 @@
66
/**
77
* Dracula Dark theme for reveal.js.
88
* Based on https://draculatheme.com
@@ -151,7 +151,9 @@ index 5330fbc1b..45498dd41 100644
151151
- }
152152
+ strong,
153153
+ b {
154-
+ color: var(--r-bold-color);
154+
+ &:not(.callout-title strong, .callout-tile b) {
155+
+ color: var(--r-bold-color);
156+
+ }
155157
+ }
156158
+ em,
157159
+ i,

package/src/common/update-html-dependencies.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,9 @@ async function updateGithubSourceCodeDependency(
11231123
await unzip(zipFile, working);
11241124

11251125
await onDownload(working, version);
1126-
if (patches) await applyGitPatches(patches);
1126+
if (patches) {
1127+
await applyGitPatches(patches);
1128+
}
11271129
} else {
11281130
throw new Error(`${versionEnvVar} is not defined`);
11291131
}

src/resources/formats/revealjs/quarto.scss

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,6 @@ $panel-sidebar-padding: 0.5em;
672672
quarto-color.blackness($backgroundColor) > $code-block-theme-dark-threshhold
673673
) {
674674
/*! dark */
675-
.reveal div.callout.callout-style-default .callout-title {
676-
color: #222;
677-
}
678675
} @else {
679676
/*! light */
680677
}
@@ -900,16 +897,15 @@ kbd {
900897
}
901898

902899
&.callout-title {
900+
display: flex;
901+
align-items: center;
902+
903903
p {
904904
margin-top: 0.5em;
905905
margin-bottom: 0.5em;
906+
color: var(--r-main-color);
906907
}
907908
}
908-
909-
&.callout-title {
910-
display: flex;
911-
align-items: center;
912-
}
913909
}
914910

915911
.callout-icon::before {

src/resources/formats/revealjs/themes/dracula.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ $light-bg-text-color: $body-bg !default;
5959
.reveal {
6060
strong,
6161
b {
62-
color: var(--r-bold-color);
62+
&:not(.callout-title strong, .callout-tile b) {
63+
color: var(--r-bold-color);
64+
}
6365
}
6466
em,
6567
i,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: callout title in dracula theme is tweak
3+
format:
4+
revealjs:
5+
theme: dracula
6+
---
7+
8+
`dracula` theme in revealjs does use a color for `<strong>` and `<b>` element. We don't want that to apply on Callout title which are using this HTML element.
9+
So we tweaked dracula theme et this test checks that color of title is like in other themes => the same as the body color.
10+
11+
## Note
12+
13+
::: {.callout-note}
14+
15+
## Title of the callout
16+
17+
Content
18+
19+
:::

tests/integration/playwright/src/utils.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,26 @@ export async function getCSSProperty(loc: Locator, variable: string, asNumber =
151151
}
152152
}
153153

154+
export async function checkCSSproperty(loc1: Locator, loc2: Locator, property: string, asNumber: false | true, checkType: 'identical' | 'similar', factor: number = 1) {
155+
let loc1Property = await getCSSProperty(loc1, property, asNumber);
156+
let loc2Property = await getCSSProperty(loc2, property, asNumber);
157+
if (checkType === 'identical') {
158+
await expect(loc2).toHaveCSS(property, loc1Property as string);
159+
} else {
160+
await expect(loc1Property).toBeCloseTo(loc2Property as number * factor);
161+
}
162+
}
163+
154164
export async function checkFontSizeIdentical(loc1: Locator, loc2: Locator) {
155-
const loc1FontSize = await getCSSProperty(loc1, 'font-size', false) as string;
156-
await expect(loc2).toHaveCSS('font-size', loc1FontSize);
165+
await checkCSSproperty(loc1, loc2, 'font-size', false, 'identical');
157166
}
158167

159168
export async function checkFontSizeSimilar(loc1: Locator, loc2: Locator, factor: number = 1) {
160-
const loc1FontSize = await getCSSProperty(loc1, 'font-size', true) as number;
161-
const loc2FontSize = await getCSSProperty(loc2, 'font-size', true) as number;
162-
await expect(loc1FontSize).toBeCloseTo(loc2FontSize * factor);
169+
await checkCSSproperty(loc1, loc2, 'font-size', true, 'similar', factor);
170+
}
171+
172+
export async function checkColorIdentical(loc1: Locator, loc2: Locator, property: string) {
173+
await checkCSSproperty(loc1, loc2, property, false, 'identical');
163174
}
164175

165176
export async function checkBorderProperties(element: Locator, side: string, color: RGBColor, width: string) {

tests/integration/playwright/tests/revealjs-themes.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect, Locator } from '@playwright/test';
2-
import { asRGB, checkColor, checkFontSizeIdentical, checkFontSizeSimilar, getCSSProperty, RGBColor } from '../src/utils';
2+
import { asRGB, checkColor, checkColorIdentical, checkFontSizeSimilar, getCSSProperty, RGBColor } from '../src/utils';
33

44
async function getRevealMainFontSize(page: any): Promise<number> {
55
return await getCSSProperty(page.locator('body'), "--r-main-font-size", true) as number;
@@ -71,4 +71,11 @@ test('Callouts can be customized using SCSS variables', async ({ page }) => {
7171
await checkCustom(page.locator('div.callout-warning'), '10px', asRGB(173, 216, 230));
7272
await checkCustom(page.locator('div.callout-important'), '10px', asRGB(128, 128, 128));
7373
await checkCustom(page.locator('div.callout-caution'), '10px', asRGB(0, 128, 0));
74+
});
75+
76+
test('Callout title color in dracula theme is correctly tweaked to use same as body color', async ({ page }) => {
77+
await page.goto('./revealjs/callouts/dracula-theme-tweaks.html#/note');
78+
const calloutTitleLoc = page.getByText('Title of the callout', { exact: true });
79+
const calloutContentLoc = page.getByText('Content', { exact: true });
80+
await checkColorIdentical(calloutTitleLoc, calloutContentLoc, 'color');
7481
});

0 commit comments

Comments
 (0)