Skip to content

Fixes 6035: Tokenize shared color constants - #32917

Merged
shah-harshit merged 5 commits into
mainfrom
issue-6035-color-constants-theme
Sep 21, 2026
Merged

shah-harshit merged 5 commits into
mainfrom
issue-6035-color-constants-theme

Conversation

@shah-harshit

@shah-harshit shah-harshit commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes https://github.com/open-metadata/openmetadata-collate/issues/6035

This replaces raw presentation colors in Color.constants.ts with project token references and adds token-backed presentation values for the shared entity palette. Fixed visualization and entity hues retain their existing values, while semantic text, surface, and status colors now follow the active light or dark theme.

Persisted entity colors remain concrete hex values. Color and icon pickers translate known stored values to presentation tokens only while rendering, so theme changes cannot rewrite metadata. Concrete canvas button colors also remain unchanged because Canvas APIs require resolver fallbacks.

Type of change:

  • Improvement

High-level design:

The core color layer now owns stable entity-palette and visualization tokens. The application exposes these through --om-* aliases with concrete fallbacks, and theme-aware status colors use utility tokens whose lightness reverses in dark mode.

ENTITY_PALETTE_HEX remains the storage-compatible API. ENTITY_PALETTE and getEntityPalettePresentationColor provide the rendering path used by the color and icon pickers.

The generated token reference now classifies utility colors as semantic tokens and includes a regression test for that contract.

Tests:

Use cases covered

  • Shared presentation constants reference project tokens.
  • Canvas resolver fallbacks remain concrete.
  • Entity palette colors render through tokens but emit stable hex values.
  • Stored icon colors render through their corresponding palette tokens.
  • Utility tokens are documented as theme-aware semantic colors.

Unit tests

  • I added unit tests for the new/changed logic.
  • Application result: 45 tests passed across 4 focused suites.
  • Core-components result: 5 tests passed across 3 focused suites.

Backend integration tests

  • Not applicable; no backend changes.

Ingestion integration tests

  • Not applicable; no ingestion changes.

Playwright (UI) tests

  • Not applicable; token contracts and picker behavior are covered by focused unit tests.

Manual testing performed

  • Ran changed-file UI checkstyle for the application and core components.
  • Ran core-components TypeScript type-check.
  • Ran token drift, token reference integrity, license-header, Tailwind audit, and whitespace checks.

UI screen recording / screenshots:

Not included; this change updates shared token primitives and preserves the existing categorical hues.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>.
  • I have linked the issue above.
  • I have commented on hard-to-understand areas.
  • JSON Schema changes are not applicable.
  • I have added tests and listed them above.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, security, or repository-rule violations were identified.

Summary

This PR moves shared presentation colors onto the project token cascade while keeping persisted entity colors and Canvas fallbacks concrete.

  • Adds a stable entity palette with separate storage and presentation values.
  • Makes semantic status colors theme-aware while preserving fixed visualization hues.
  • Updates color and icon pickers to render known stored colors through presentation tokens.
  • Extends token-reference generation and focused regression coverage.
  • Updates affected Playwright fixtures to select values from the new palette.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Stored[Persisted entity hex value] --> Match{Known palette value?}
  Match -->|Yes| Token[Entity presentation token]
  Match -->|No| Custom[Original custom color]
  Token --> Cascade[Active theme cascade]
  Cascade --> Picker[Color and icon picker rendering]
  Custom --> Picker
  Picker --> Save[Emit concrete hex value]
Loading

Reviews (4) · Last reviewed commit: "test(ui): use current entity-palette hex..."

@shah-harshit shah-harshit added the UI UI specific issues label Sep 8, 2026
@shah-harshit shah-harshit self-assigned this Sep 8, 2026
@shah-harshit shah-harshit added skip-pr-checks Bypass PR metadata validation check safe to test Add this label to run secure Github workflows on PRs labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 70c1430e2c187efe597ad7a7edee1d2e2ddded37 in Playwright run 35584208622, attempt 1.

✅ 4535 passed · ❌ 0 failed · 🟡 9 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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) 53m 21s

⏱️ Max setup 6m 3s · max shard execution 22m 4s · max shard-job elapsed before upload 25m 10s · reporting 23s

🌐 224.72 requests/attempt · 2.23 app boots/UI scenario · 39.20% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 39.2% (convergence target: at most 15%).
  • Browser traffic was 224.72 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.23 per UI scenario (10778 boots / 4841 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard advanced-search-01 67 0 0 0 0 0
✅ Shard advanced-search-02 63 0 0 0 0 0
🟡 Shard chromium-01 131 0 1 0 0 0
🟡 Shard chromium-02 150 0 1 0 0 0
✅ Shard chromium-03 138 0 0 0 0 0
🟡 Shard chromium-04 154 0 1 1 0 0
🟡 Shard chromium-05 152 0 1 0 0 0
✅ Shard chromium-06 164 0 0 0 0 0
🟡 Shard chromium-07 152 0 1 0 0 0
✅ Shard chromium-08 162 0 0 0 0 0
🟡 Shard chromium-09 153 0 1 0 0 0
✅ Shard chromium-10 161 0 0 0 0 0
✅ Shard chromium-11 138 0 0 0 0 0
✅ Shard chromium-12 180 0 0 0 0 0
✅ Shard chromium-13 122 0 0 0 0 0
✅ Shard chromium-14 183 0 0 0 0 0
✅ Shard chromium-15 173 0 0 0 0 0
🟡 Shard chromium-16 192 0 1 0 0 0
✅ Shard chromium-17 159 0 0 0 0 0
✅ Shard chromium-18 150 0 0 0 0 0
✅ Shard chromium-19 184 0 0 0 0 0
✅ Shard chromium-20 158 0 0 0 0 0
✅ Shard chromium-21 129 0 0 0 0 0
✅ Shard chromium-22 173 0 0 0 0 0
✅ Shard chromium-23 168 0 0 0 0 0
✅ Shard chromium-24 145 0 0 0 0 0
🟡 Shard chromium-25 190 0 1 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 92 0 0 0 0 0
✅ Shard import-export-02 34 0 0 0 0 0
✅ Shard import-export-03 24 0 0 0 0 0
🟡 Shard ingestion-01 45 0 1 0 0 0
✅ Shard ingestion-02 53 0 0 0 0 0
✅ Shard reindex-01 40 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 9 flaky test(s) (passed on retry)
  • Flow/AddRoleAndAssignToUser.spec.ts › Verify assigned role to new user (shard chromium-01, 1 retry)
  • Features/ContextCenterArticles.spec.ts › multiple articles hold independent drafts simultaneously (shard chromium-02, 1 retry)
  • Features/AccessControlSettings.spec.ts › should show all 4 landing cards and navigate to each panel (shard chromium-04, 1 retry)
  • Pages/ExploreTree.spec.ts › Explore Tree (shard chromium-05, 1 retry)
  • Pages/UserDetails.spec.ts › Create team with domain and verify visibility of inherited domain in user profile after team removal (shard chromium-07, 1 retry)
  • Features/ContextCenterMemories.spec.ts › Entity memory shows "visible to linked entities" description (shard chromium-09, 1 retry)
  • Features/AccessControlSettings.spec.ts › should remove a policy from a role (shard chromium-16, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard chromium-25, 1 retry)
  • Features/IncidentManager.spec.ts › Complete Incident lifecycle with table owner (shard ingestion-01, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@gitar-bot

gitar-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

Confirmed — checked CardinalityDistributionChart.component.tsx:97 (<text fill={tickFill}>) and the other consumers cited, and rechecked current browser behavior. Presentation attributes are defined by SVG2/CSS to carry author-level style specificity, so var() substitution applies to them the same as to the style property in all currently supported browsers (Chromium, Firefox, Safari 16.4+). The black/no-substitution failure mode only exists on much older engines that aren't in this project's support matrix.

Withdrawing this finding — no code change needed here.

…tants-theme

# Conflicts:
#	openmetadata-ui-core-components/src/main/resources/ui/src/colors/entityPalette.ts
#	openmetadata-ui-core-components/src/main/resources/ui/src/components/application/form-field/fields/icon-picker-field.tsx
#	openmetadata-ui/src/main/resources/ui/scripts/design-tokens/gen-token-reference.js
#	openmetadata-ui/src/main/resources/ui/specs/tokens/token-reference.md
Color.constants tokenization (this PR) changed the chart's bar fills from raw
hex to var(--om-color-*) tokens (GREEN_4/RED_3/YELLOW_3/BLUE_1). Update the
'correct colors for bars' assertions from #039855/#f24822/#f79009/#175cd3 to the
matching visualization/warning/brand tokens. Fixes the failing Run Coverage step.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 72%
72.39% (103328/142720) 57.5% (62929/109432) 58.53% (20593/35179)

entityPalette redefinition (this PR) replaced the old palette values, so the
color picker no longer renders swatches for #B93815/#067647/#C11574. E2E tests
that click 'Select color <hex>' for those removed values timed out. Point them
at current palette hexes (#1470EF/#05A580/#F14C75) in the glossary and tag
style-color flows.
@gitar-bot

gitar-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown
Code Review ✅ No issues found 2 closed / 2 findings

🟡 Medium risk · Shared UI color tokens change theme rendering across pickers and charts.

Tokenizes shared color constants to follow the active theme, with entity palette colors rendered through tokens while remaining concrete in storage. The default icon-picker background color changed from blue to amber, which was addressed in a follow-up commit.

✅ 2 closed
✅ Bug: Default icon-picker background color silently changed blue→amber

📄 openmetadata-ui-core-components/src/main/resources/ui/src/components/application/form-field/fields/icon-picker-field.tsx:111-116
In icon-picker-field.tsx the fallback default changed from ENTITY_PALETTE_HEX[0] (#1470EF, blue) to ENTITY_PALETTE_HEX[6] (#FFB01A, amber). Callers such as AddGlossaryTermForm pass backgroundColor={selectedColor} where selectedColor is Form.useWatch('color') and is undefined until the user picks a color, so the icon preview now renders amber by default instead of blue. This is an unexplained behavioral change bundled into a token-refactor PR and appears unrelated to tokenization. If the new default is intentional, add a comment justifying the index; otherwise restore index 0.

Closed: Bug: var() color constants break in SVG presentation attributes

📄 openmetadata-ui/src/main/resources/ui/src/constants/Color.constants.ts:19-33
Chart color constants in Color.constants.ts were changed from concrete hex (e.g. #4689FF) to CSS custom-property strings like var(--om-color-visualization-chart-blue-1). Several consumers apply these values as SVG presentation attributes rather than CSS style — e.g. CardinalityDistributionChart renders <text fill={tickFill}> where tickFill is CHART_BLUE_1/GRAY_600/COLOR_GREY_400, and Recharts <Area fill={GREEN_3}> / pie fill props render as attributes on the underlying SVG nodes. var() is not substituted inside SVG presentation attributes (only inside the CSS style property or stylesheets), so these fills resolve to the default (black/inherited) and the charts render with wrong colors. None of the added tests catch this because they only assert the exported string values. Either resolve these tokens to concrete values at the point they feed SVG attributes, or apply them via inline style/CSS instead of the fill/stroke attribute.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants