Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion e2e/playwright/tests/common/themeModes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const exportedHaloFrom = (page: Page, selector: string): Promise<Exported> => ex

const DECLARED_BLUE = 'rgb(11, 7, 3)';
const DECLARED_BG = 'rgb(22, 7, 3)';
const DECLARED_ON_COLOR = 'rgb(33, 7, 3)';
const HANDED_OUT_BLUE = '#0b0703';

const declareTheNamesTheWidgetsRead = (
Expand Down Expand Up @@ -564,6 +565,9 @@ test.describe('Theme modes', () => {

test('dxRangeSelector paints from a name the page declared, leaving no reference behind', async ({ page }) => {
await declareTheNamesTheWidgetsRead(page, DECLARED_BLUE, DECLARED_BG);
await page.evaluate((onColor) => {
document.documentElement.style.setProperty('--dx-viz-content-on-color', onColor);
}, DECLARED_ON_COLOR);
await createWidget(page, 'dxRangeSelector', {
...{
scale: { startValue: 0, endValue: 10 },
Expand All @@ -572,7 +576,7 @@ test.describe('Theme modes', () => {
size: { width: 220, height: 160 },
});

await expectPaintedFrom(page, DECLARED_BG);
await expectPaintedFrom(page, DECLARED_ON_COLOR);
});

test('every viz widget the namespace exposes has a test of its own', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ $viz-border: ds.$color-border !default;
$viz-border-active: ds.$color-border-active !default;
$viz-border-hovered: ds.$color-border-hovered !default;
$viz-content: ds.$color-content !default;
$viz-content-on-color: ds.$color-content-on-color !default;
$viz-content-orange: ds.$color-content-orange !default;
$viz-content-subtle: ds.$color-content-subtle !default;
$viz-content-subtler: ds.$color-content-subtler !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
--dx-viz-border-active: #{$viz-border-active};
--dx-viz-border-hovered: #{$viz-border-hovered};
--dx-viz-content: #{$viz-content};
--dx-viz-content-on-color: #{$viz-content-on-color};
--dx-viz-content-orange: #{$viz-content-orange};
--dx-viz-content-subtle: #{$viz-content-subtle};
--dx-viz-content-subtler: #{$viz-content-subtler};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,7 @@
"--dx-viz-border-active",
"--dx-viz-border-hovered",
"--dx-viz-content",
"--dx-viz-content-on-color",
"--dx-viz-content-orange",
"--dx-viz-content-subtle",
"--dx-viz-content-subtler",
Expand Down
6 changes: 6 additions & 0 deletions packages/devextreme-scss/tools/naming/viz-contract.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
"declaredPerMode": true,
"paints": "the axis and everything that reads with it: the widget font colour that axis and legend labels take, the axis line and its ticks, and the titles of the axes. A step quieter than the rest of the text on purpose - the numbers along a scale are there to be read past, not at. The subtitle under the chart title is not among them: it inherits the colour of the title"
},
{
"name": "--dx-viz-content-on-color",
"role": "color-content-on-color",
"declaredPerMode": true,
"paints": "the text on the slider flags of a range selector, laid over the primary fill or the danger fill of an invalid range, so it stays the same light colour in both modes"
},
{
"name": "--dx-viz-content-orange",
"role": "color-content-orange",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const VIZ_BORDER = '--dx-viz-border';
const VIZ_BORDER_ACTIVE = '--dx-viz-border-active';
const VIZ_BORDER_HOVERED = '--dx-viz-border-hovered';
const VIZ_CONTENT = '--dx-viz-content';
const VIZ_CONTENT_ON_COLOR = '--dx-viz-content-on-color';
const VIZ_CONTENT_ORANGE = '--dx-viz-content-orange';
const VIZ_CONTENT_SUBTLE = '--dx-viz-content-subtle';
const VIZ_CONTENT_SUBTLER = '--dx-viz-content-subtler';
Expand Down Expand Up @@ -48,6 +49,7 @@ const LIGHT = {
[VIZ_BORDER_ACTIVE]: '#b6b6b6',
[VIZ_BORDER_HOVERED]: '#c0c0c0',
[VIZ_CONTENT]: '#161616',
[VIZ_CONTENT_ON_COLOR]: '#ffffff',
[VIZ_CONTENT_ORANGE]: '#ad4100',
[VIZ_CONTENT_SUBTLE]: '#444444',
[VIZ_CONTENT_SUBTLER]: '#656565',
Expand Down Expand Up @@ -92,6 +94,7 @@ const DARK: Record<PublishedName, string> = {
[VIZ_BORDER_ACTIVE]: '#656565',
[VIZ_BORDER_HOVERED]: '#ababab',
[VIZ_CONTENT]: '#ffffff',
[VIZ_CONTENT_ON_COLOR]: '#ffffff',
[VIZ_CONTENT_ORANGE]: '#f57d48',
[VIZ_CONTENT_SUBTLE]: '#cbcbcb',
[VIZ_CONTENT_SUBTLER]: '#a1a1a1',
Expand Down Expand Up @@ -318,7 +321,7 @@ function buildTheme(name: string, fallback: Record<PublishedName, string>): any
sliderMarker: {
color: paint(VIZ_PRIMARY),
font: {
color: paint(VIZ_BG),
color: paint(VIZ_CONTENT_ON_COLOR),
},
invalidRangeColor: paint(VIZ_DANGER),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ const PUBLISHED_GREEN = 'var(--dx-viz-green, #008f04)';
const PUBLISHED_RED = 'var(--dx-viz-red, #c83d3d)';
const PUBLISHED_YELLOW = 'var(--dx-viz-yellow, #eaa300)';

const LIGHT_VIVID = { primary: 'var(--dx-viz-primary, #0f6cbd)', danger: 'var(--dx-viz-danger, #c50f1f)', yellow: 'var(--dx-viz-yellow, #eaa300)', orange: 'var(--dx-viz-orange, #f7630c)' };
const DARK_VIVID = { primary: 'var(--dx-viz-primary, #015fab)', danger: 'var(--dx-viz-danger, #b20017)', yellow: 'var(--dx-viz-yellow, #cd8e00)', orange: 'var(--dx-viz-orange, #d25101)' };
const LIGHT_VIVID = { primary: 'var(--dx-viz-primary, #0f6cbd)', danger: 'var(--dx-viz-danger, #c50f1f)', yellow: 'var(--dx-viz-yellow, #eaa300)', orange: 'var(--dx-viz-orange, #f7630c)', onColor: 'var(--dx-viz-content-on-color, #ffffff)' };
const DARK_VIVID = { primary: 'var(--dx-viz-primary, #015fab)', danger: 'var(--dx-viz-danger, #b20017)', yellow: 'var(--dx-viz-yellow, #cd8e00)', orange: 'var(--dx-viz-orange, #d25101)', onColor: 'var(--dx-viz-content-on-color, #ffffff)' };

[
{ theme: 'fluent-next.blue.light', surface: 'var(--dx-viz-bg, #ffffff)', hovered: 'var(--dx-viz-bg-hovered, #f5f5f5)', pressed: 'var(--dx-viz-bg-active, #e1e1e1)', plate: 'var(--dx-viz-tooltip-bg, #242424)', onPlate: 'var(--dx-viz-tooltip-content, #ffffff)', ink: 'var(--dx-viz-content, #161616)', shelf: 'var(--dx-viz-bg-higher, #ebebeb)', quiet: 'var(--dx-viz-gray-subtle, #cfcfcf)', needle: 'var(--dx-viz-content-subtle, #444444)', crosshair: 'var(--dx-viz-crosshair, #b33133)', mapLineHovered: 'var(--dx-viz-content-orange, #ad4100)', rangePlate: 'var(--dx-viz-purple-subtle, #d5c7f0)', axis: 'var(--dx-viz-content-subtler, #656565)', frame: 'var(--dx-viz-border, #cbcbcb)', ...LIGHT_VIVID },
Expand All @@ -386,7 +386,7 @@ const DARK_VIVID = { primary: 'var(--dx-viz-primary, #015fab)', danger: 'var(--d
{ theme: 'fluent-next.blue.dark.compact', surface: 'var(--dx-viz-bg, #242424)', hovered: 'var(--dx-viz-bg-hovered, #3b3b3b)', pressed: 'var(--dx-viz-bg-active, #1d1d1d)', plate: 'var(--dx-viz-tooltip-bg, #ffffff)', onPlate: 'var(--dx-viz-tooltip-content, #161616)', ink: 'var(--dx-viz-content, #ffffff)', shelf: 'var(--dx-viz-bg-higher, #333333)', quiet: 'var(--dx-viz-gray-subtle, #4a4a4a)', needle: 'var(--dx-viz-content-subtle, #cbcbcb)', crosshair: 'var(--dx-viz-crosshair, #e87e78)', mapLineHovered: 'var(--dx-viz-content-orange, #f57d48)', rangePlate: 'var(--dx-viz-purple-subtle, #563780)', axis: 'var(--dx-viz-content-subtler, #a1a1a1)', frame: 'var(--dx-viz-border, #767676)', ...DARK_VIVID },
].forEach(({
theme, surface, hovered, pressed, plate, onPlate, ink, shelf, quiet, needle, crosshair,
mapLineHovered, rangePlate, axis, frame, primary, danger, yellow, orange,
mapLineHovered, rangePlate, axis, frame, primary, danger, yellow, orange, onColor,
}) => {
QUnit.test(`fluent-next theme should be registered: ${theme}`, function(assert) {
themeModule.currentTheme(theme);
Expand Down Expand Up @@ -467,10 +467,15 @@ const DARK_VIVID = { primary: 'var(--dx-viz-primary, #015fab)', danger: 'var(--d
assert.strictEqual(registeredTheme.export.button.default.backgroundColor, surface, 'export button background');
});

QUnit.test(`fluent-next theme should draw the slider marker text with the published on-color content: ${theme}`, function(assert) {
const registeredTheme = getRegisteredTheme(theme);

assert.strictEqual(registeredTheme.rangeSelector.sliderMarker.font.color, onColor, 'rangeSelector slider marker text');
});

QUnit.test(`fluent-next theme should cut shapes out with the published surface: ${theme}`, function(assert) {
const registeredTheme = getRegisteredTheme(theme);

assert.strictEqual(registeredTheme.rangeSelector.sliderMarker.font.color, surface, 'rangeSelector slider marker text');
assert.strictEqual(registeredTheme.chart.crosshair.label.font.color, surface, 'crosshair label text');
assert.strictEqual(registeredTheme.map['layer:marker:dot'].borderColor, surface, 'map dot marker ring');
assert.strictEqual(registeredTheme.map['layer:marker:dot'].backColor, surface, 'map dot marker back disc');
Expand Down
Loading