Repository navigation
Fluent Next: sync the custom accent formula with Blazor #36413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Raushen
wants to merge
6
commits into
DevExpress:main
Choose a base branch
from
Raushen:27_1_fluent-next_accent-sync
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+75
−107
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
771f0a9
Fluent Next: sync the custom accent formula with Blazor
Raushen a4833dd
Update the accent palette screenshots
Raushen 818b7e2
Cover the custom accent normalization with a test
Raushen d550c54
Tighten the designed palette tolerance
Raushen cf4512b
Drop the Chrome 145 check the new formula never hits
Raushen dc73223
Say grays come out at about 0.525 in the accent contract
Raushen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-453 Bytes
(99%)
...evextreme/tests/common/etalons/Accent palette blue (fluent-next.blue.light).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-232 Bytes
(99%)
...evextreme/tests/common/etalons/Accent palette mint (fluent-next.blue.light).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-533 Bytes
(99%)
...evextreme/tests/common/etalons/Accent palette rust (fluent-next.blue.light).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 21 additions & 22 deletions
43
packages/devextreme-scss/scss/widgets/fluent-next/_accent-color.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,25 @@ | ||
| // sync between Blazor and DevExtreme (plus vNext and WPF in the future) | ||
| @supports (color: oklch(from red l c h)) { | ||
| :root { | ||
| --dx-accent-color-source: var(--dx-accent-color); | ||
| --dx-accent-lightness-max: 0.975; | ||
| --dx-accent-lightness-min: 0.15; | ||
| --dx-accent-chroma-min: 0.02; | ||
| --dx-accent-color-10: oklch(from var(--dx-accent-color-source) max(l, var(--dx-accent-lightness-max)) min(c, var(--dx-accent-chroma-min)) h / 1); | ||
| --dx-accent-color-20: oklch(from var(--dx-accent-color-source) calc(l + 8 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 8 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-30: oklch(from var(--dx-accent-color-source) calc(l + 7 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 7 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-40: oklch(from var(--dx-accent-color-source) calc(l + 6 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 6 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-50: oklch(from var(--dx-accent-color-source) calc(l + 5 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 5 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-60: oklch(from var(--dx-accent-color-source) calc(l + 4 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 4 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-70: oklch(from var(--dx-accent-color-source) calc(l + 3 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 3 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-80: oklch(from var(--dx-accent-color-source) calc(l + 2 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 2 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-90: oklch(from var(--dx-accent-color-source) calc(l + 1 * (var(--dx-accent-lightness-max) - min(l, var(--dx-accent-lightness-max))) / 9) calc(c - 1 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 9) h / 1); | ||
| --dx-accent-color-100: oklch(from var(--dx-accent-color-source) l c h / 1); | ||
| --dx-accent-color-110: oklch(from var(--dx-accent-color-source) calc(l - 1 * (max(l, var(--dx-accent-lightness-min)) - var(--dx-accent-lightness-min)) / 8) calc(c - 1 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 8) h / 1); | ||
| --dx-accent-color-120: oklch(from var(--dx-accent-color-source) calc(l - 2 * (max(l, var(--dx-accent-lightness-min)) - var(--dx-accent-lightness-min)) / 8) calc(c - 2 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 8) h / 1); | ||
| --dx-accent-color-130: oklch(from var(--dx-accent-color-source) calc(l - 3 * (max(l, var(--dx-accent-lightness-min)) - var(--dx-accent-lightness-min)) / 8) calc(c - 3 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 8) h / 1); | ||
| --dx-accent-color-140: oklch(from var(--dx-accent-color-source) calc(l - 4 * (max(l, var(--dx-accent-lightness-min)) - var(--dx-accent-lightness-min)) / 8) calc(c - 4 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 8) h / 1); | ||
| --dx-accent-color-150: oklch(from var(--dx-accent-color-source) calc(l - 5 * (max(l, var(--dx-accent-lightness-min)) - var(--dx-accent-lightness-min)) / 8) calc(c - 5 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 8) h / 1); | ||
| --dx-accent-color-160: oklch(from var(--dx-accent-color-source) calc(l - 6 * (max(l, var(--dx-accent-lightness-min)) - var(--dx-accent-lightness-min)) / 8) calc(c - 6 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 8) h / 1); | ||
| --dx-accent-color-170: oklch(from var(--dx-accent-color-source) calc(l - 7 * (max(l, var(--dx-accent-lightness-min)) - var(--dx-accent-lightness-min)) / 8) calc(c - 7 * (max(c, var(--dx-accent-chroma-min)) - var(--dx-accent-chroma-min)) / 8) h / 1); | ||
| --dx-accent-color-180: oklch(from var(--dx-accent-color-source) min(l, var(--dx-accent-lightness-min)) min(c, var(--dx-accent-chroma-min)) h / 1); | ||
| /* Normalizes the accent: lightness clamped to 45–60%, achromatic accents (white, black, grays) use 52.5% lightness, alpha forced to 100% */ | ||
| --dx-accent-color-base: oklch(from var(--dx-accent-color) calc(0.525 + (clamp(0.45, l, 0.6) - 0.525) * min(1, c / 0.02)) c h / 1); | ||
| --dx-accent-color-10: oklch(from var(--dx-accent-color-base) 98% calc(c * (0.98 - 0.12 * 8)) h); | ||
|
Raushen marked this conversation as resolved.
Resolved
|
||
| --dx-accent-color-20: oklch(from var(--dx-accent-color-base) 95% calc(c * (0.98 - 0.12 * 7)) h); | ||
| --dx-accent-color-30: oklch(from var(--dx-accent-color-base) 90% calc(c * (0.98 - 0.12 * 6)) h); | ||
| --dx-accent-color-40: oklch(from var(--dx-accent-color-base) 85% calc(c * (0.98 - 0.12 * 5)) h); | ||
| --dx-accent-color-50: oklch(from var(--dx-accent-color-base) 80% calc(c * (0.98 - 0.12 * 4)) h); | ||
| --dx-accent-color-60: oklch(from var(--dx-accent-color-base) 75% calc(c * (0.98 - 0.12 * 3)) h); | ||
| --dx-accent-color-70: oklch(from var(--dx-accent-color-base) calc(0.75 + (l - 0.75) / 4 * 1) calc(c * (0.98 - 0.12 * 2)) h); | ||
| --dx-accent-color-80: oklch(from var(--dx-accent-color-base) calc(0.75 + (l - 0.75) / 4 * 2) calc(c * (0.98 - 0.12 * 1)) h); | ||
| --dx-accent-color-90: oklch(from var(--dx-accent-color-base) calc(0.75 + (l - 0.75) / 4 * 3) calc(c * (0.98 - 0.12 * 0)) h); | ||
| --dx-accent-color-100: oklch(from var(--dx-accent-color-base) l c h); | ||
| --dx-accent-color-110: oklch(from var(--dx-accent-color-base) calc(l + (0.35 - l) / 4 * 1) calc(c * (0.95 - 0.1 * 0)) h); | ||
| --dx-accent-color-120: oklch(from var(--dx-accent-color-base) calc(l + (0.35 - l) / 4 * 2) calc(c * (0.95 - 0.1 * 1)) h); | ||
| --dx-accent-color-130: oklch(from var(--dx-accent-color-base) calc(l + (0.35 - l) / 4 * 3) calc(c * (0.95 - 0.1 * 2)) h); | ||
| --dx-accent-color-140: oklch(from var(--dx-accent-color-base) 35% calc(c * (0.95 - 0.1 * 3)) h); | ||
| --dx-accent-color-150: oklch(from var(--dx-accent-color-base) 30% calc(c * (0.95 - 0.1 * 4)) h); | ||
| --dx-accent-color-160: oklch(from var(--dx-accent-color-base) 25% calc(c * (0.95 - 0.1 * 5)) h); | ||
| --dx-accent-color-170: oklch(from var(--dx-accent-color-base) 20% calc(c * (0.95 - 0.1 * 6)) h); | ||
| --dx-accent-color-180: oklch(from var(--dx-accent-color-base) 15% calc(c * (0.95 - 0.1 * 7)) h); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| { | ||
| "dx.fluent-next.blue.dark.compact.css": { | ||
| "calcOccurrences": 389, | ||
| "calcOccurrences": 383, | ||
| "declarationsWithDeepCalc": 5 | ||
| }, | ||
| "dx.fluent-next.blue.dark.css": { | ||
| "calcOccurrences": 390, | ||
| "calcOccurrences": 384, | ||
| "declarationsWithDeepCalc": 5 | ||
| }, | ||
| "dx.fluent-next.blue.light.compact.css": { | ||
| "calcOccurrences": 389, | ||
| "calcOccurrences": 383, | ||
| "declarationsWithDeepCalc": 5 | ||
| }, | ||
| "dx.fluent-next.blue.light.css": { | ||
| "calcOccurrences": 390, | ||
| "calcOccurrences": 384, | ||
| "declarationsWithDeepCalc": 5 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 5 additions & 19 deletions
24
packages/devextreme-scss/tools/naming/accent-contract.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,21 @@ | ||
| { | ||
| "comment": "The application -> CSS contract of the custom accent, the mirror image of runtime-contract.json's JS -> CSS one: an application writes ONE colour into --dx-accent-color, through themes.customAccentColor or by hand, and scss/widgets/fluent-next/_accent-color.scss derives the whole primary scale from it with relative colour syntax. These names are not part of the component tier - `accent` is neither a component nor a registered system concern - and fluent-next is the only theme that derives a palette, so tests/fluent-next-naming.test.ts excludes them from the public-surface checks. tests/accent-palette.test.ts holds the stylesheet, the generated palettes and the built bundles to this file.", | ||
| "comment": "The application -> CSS contract of the custom accent, the mirror image of runtime-contract.json's JS -> CSS one: an application writes ONE colour into --dx-accent-color, through themes.customAccentColor or by hand, and scss/widgets/fluent-next/_accent-color.scss derives the whole primary scale from it with relative colour syntax, by the same formula as the Blazor Fluent theme; the two copies are kept in sync by hand. These names are not part of the component tier - `accent` is neither a component nor a registered system concern - and fluent-next is the only theme that derives a palette, so tests/fluent-next-naming.test.ts excludes them from the public-surface checks. tests/accent-palette.test.ts holds the stylesheet, the generated palettes and the built bundles to this file.", | ||
| "declaredIn": "fluent-next/_accent-color.scss", | ||
| "input": { | ||
| "name": "--dx-accent-color", | ||
| "setBy": "themes.customAccentColor(color), the documented entry point, or the application itself writing the property on the root element", | ||
| "acceptedForms": "any colour the browser parses, including var(--custom-property) pointing at one; a value that resolves to no colour, or to another element's colour such as currentColor or inherit, is refused with W0024", | ||
| "whenUnset": "every derived step is invalid at computed-value time, so each generated palette keeps the designed colour through var(--dx-accent-color-<step>, <designed value>)" | ||
| }, | ||
| "source": { | ||
| "name": "--dx-accent-color-source", | ||
| "purpose": "the single read of the application's name, so the 18 step expressions do not each carry it" | ||
| "base": { | ||
| "name": "--dx-accent-color-base", | ||
| "purpose": "the accent normalized once: lightness clamped to 0.45-0.6 and pulled towards 0.525 as chroma falls under 0.02, so white, black and grays come out at about 0.525; alpha forced to 1. Every step is built from it, and step 100 is this normalized accent rather than the colour the application wrote" | ||
| }, | ||
| "settings": [ | ||
| { | ||
| "name": "--dx-accent-lightness-max", | ||
| "purpose": "the lightness the light end of the scale arrives at" | ||
| }, | ||
| { | ||
| "name": "--dx-accent-lightness-min", | ||
| "purpose": "the lightness the dark end of the scale arrives at" | ||
| }, | ||
| { | ||
| "name": "--dx-accent-chroma-min", | ||
| "purpose": "the chroma both ends fade to" | ||
| } | ||
| ], | ||
| "steps": { | ||
| "prefix": "--dx-accent-color-", | ||
| "values": [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180], | ||
| "readIn": "_design-system/fluent/accents/*.scss", | ||
| "alpha": "every step ends in `/ 1`: relative colour syntax hands the alpha of the origin colour down, so an accent written with one would otherwise fade the whole scale", | ||
| "alpha": "the base ends in `/ 1`: relative colour syntax hands the alpha of the origin colour down, so an accent written with one would otherwise fade the whole scale; every step is built from the base and inherits its alpha", | ||
| "fallback": "the designed value of the step, so an unset accent leaves the theme exactly as drawn" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.