Repository navigation
Fixes 6035: Add theme-aware canvas color resolution - #32423
Conversation
Code Review ✅ Approved 1 resolved / 1 findingsAdds theme-aware canvas color resolution through a shared CSS token resolver with LRU caching, enabling non-DOM rendering (canvas/WebGL) to respect light/dark mode and custom branding. The color guard now accepts modern CSS color functions, and comprehensive unit tests verify theme switching, fallback behavior, cache bounds, and token documentation coverage. No issues found. ✅ 1 resolved✅ Edge Case: Color guard rejects modern CSS color functions
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
| Count | Rule |
|---|---|
| 5 | sonarjs/no-nested-conditional |
| 2 | sonarjs/cyclomatic-complexity |
| 1 | sonarjs/cognitive-complexity |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:538:17 |
sonarjs/cognitive-complexity |
Refactor this function to reduce its Cognitive Complexity from 23 to the 15 allowed. |
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:538:17 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 23 which is greater than 10 authorized.","cost":13,"secondaryLocations":[{"line":538,"column":16,"endLine":538,"endColu |
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:567:9 |
sonarjs/no-nested-conditional |
Extract this nested ternary operation into an independent statement. |
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:572:9 |
sonarjs/no-nested-conditional |
Extract this nested ternary operation into an independent statement. |
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:575:48 |
sonarjs/no-nested-conditional |
Extract this nested ternary operation into an independent statement. |
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:578:9 |
sonarjs/no-nested-conditional |
Extract this nested ternary operation into an independent statement. |
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:594:9 |
sonarjs/no-nested-conditional |
Extract this nested ternary operation into an independent statement. |
| 🟡 | src/components/OntologyExplorer/utils/graphStyles.ts:710:17 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 11 which is greater than 10 authorized.","cost":1,"secondaryLocations":[{"line":710,"column":16,"endLine":710,"endColum |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed
|
✅ Playwright Results — workflow succeededValidated commit ✅ 604 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 1h 18m 15s ⏱️ Max setup 4m 17s · max shard execution 19m 18s · max shard-job elapsed before upload 22m 45s · reporting 5s 🌐 211.68 requests/attempt · 2.59 app boots/UI scenario · 14.08% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |



Describe your changes:
Part of open-metadata/openmetadata-collate#6035
This adds the OSS foundation for theme-aware non-DOM rendering. Canvas and WebGL consumers can now resolve CSS color tokens through a shared bounded resolver without retaining stale light-theme or brand colors. Ontology Explorer now uses the shared resolver through its existing
getCanvasColorAPI.The change also centralizes
--om-page-height, restores deterministic token drift, and ensures every project token appears in the generated token reference.Type of change:
High-level design:
background-colorprobe so invalid variables cannot fall back to unrelated inherited text colors.getCanvasColorAPI while moving its implementation into a shared utility.tokens.cssand keep scoped recomputation where shell height changes.--om-*definition.No migration or backward-compatibility concerns; existing concrete color inputs and fallback behavior are preserved.
Tests:
Use cases covered
Unit tests
cssColor.utils.test.ts,graphStyles.test.ts,gen-token-reference.test.js.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
No standalone visual flow is introduced in this foundation PR. Runtime theme, branding, fallback, and cache behavior are covered by focused unit tests.
UI screen recording / screenshots:
Not applicable; component-level semantic token migrations will consume this foundation in follow-up PRs.
Checklist:
Fixes <issue-number>: <short explanation>.Improvement