Skip to content

feat(react-charts): add high contrast#12419

Open
mcoker wants to merge 8 commits into
patternfly:mainfrom
mcoker:hc-charts
Open

feat(react-charts): add high contrast#12419
mcoker wants to merge 8 commits into
patternfly:mainfrom
mcoker:hc-charts

Conversation

@mcoker
Copy link
Copy Markdown
Contributor

@mcoker mcoker commented May 8, 2026

Relies on patternfly/patternfly#8379 as the core dependency to work

Updates charts with high contrast styles - it's the react half of patternfly/patternfly#7949

Has some hero component changes to pass the build that will need to be removed before merging.

Ran visual regressions for charts in light/dark/hc

Light

Light high contrast

Dark

Dark high contrast

Summary by CodeRabbit

  • Chores

    • Updated PatternFly dependency to 6.5.0-prerelease.86 across packages for compatibility and stability.
  • Chart Improvements

    • Chart themes updated to use CSS variable tokens for more consistent styling (including stroke and stroke width).
    • Legend styling refined to remove unwanted outlines.
    • Skeleton color scales adjusted for improved visual consistency.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR updates Victory and ECharts chart themes to use CSS variable tokens for stroke color and strokeWidth (and some fillOpacity) across area, bar, legend, pie, bullet, and donut components; switches skeleton color scales to chart_skeleton tokens; and bumps @patternfly/patternfly dev/dependencies from 6.5.0-prerelease.82 to 6.5.0-prerelease.86.

Changes

Chart Theme Token Styling

Layer / File(s) Summary
Token Imports
packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts, packages/react-charts/src/echarts/components/themes/colors/skeleton-theme.ts, packages/react-charts/src/victory/components/ChartTheme/themes/colors/skeleton-theme.ts
Adds/replaces imports for legend, donut, and bullet stroke tokens and skeleton color scale tokens.
Base Theme Style Updates
packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts
Area, bar, pie switch some token .value usages to .var; legend data style now includes stroke and strokeWidth from legend tokens.
Component Theme Styling
packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts
Bullet primary dot/segmented measure styles add scatter/bar stroke and strokeWidth; donut variants add pie.style.data.stroke and pie.style.data.strokeWidth.
Skeleton Color Scale & Legend Data
packages/react-charts/src/echarts/components/themes/colors/skeleton-theme.ts, packages/react-charts/src/victory/components/ChartTheme/themes/colors/skeleton-theme.ts, packages/react-charts/src/victory/components/ChartTheme/themes/skeleton-theme.ts
ECharts and Victory skeleton color scales now use chart_skeleton_ColorScale_{100..500}; Victory ColorTheme.legend.style.data sets stroke: 'transparent' and strokeWidth: 0.

Dependency Updates

Layer / File(s) Summary
PatternFly Dependency Bump
packages/react-core/package.json, packages/react-docs/package.json, packages/react-icons/package.json, packages/react-styles/package.json, packages/react-tokens/package.json
@patternfly/patternfly updated from 6.5.0-prerelease.82 to 6.5.0-prerelease.86 across listed packages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • nicolethoen
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive All changes are focused on high contrast chart theming and necessary dependency updates; however, the PR description mentions temporary hero component changes that will be removed before merging, which could be considered out-of-scope. Clarify whether temporary hero component changes have been included in this PR or if they will be added separately; ensure only in-scope high contrast chart changes are present at merge time.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(react-charts): add high contrast' directly addresses the main objective of the PR—implementing high contrast styling for react-charts. It is concise, clear, and accurately summarizes the primary change.
Linked Issues check ✅ Passed The PR implements high contrast styling for charts across multiple theme files and updates PatternFly token dependencies as required by issue #12053, meeting all coding-related requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented May 8, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts (2)

175-178: 💤 Low value

area.style.data.strokeWidth not migrated to .var

Within the same data block, fillOpacity was migrated to .var for high-contrast CSS-variable support, but strokeWidth on line 178 still uses .value. Since stroke is intentionally commented out, this has no current visual impact, but it leaves the token unable to respond to CSS variable overrides if stroke is re-enabled later.

🔧 Proposed fix
-        strokeWidth: chart_area_stroke_Width.value
+        strokeWidth: chart_area_stroke_Width.var
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts`
around lines 175 - 178, The area style's data block uses
chart_area_stroke_Width.value for strokeWidth while fillOpacity was migrated to
chart_area_Opacity.var; update the area.style.data property named strokeWidth to
use chart_area_stroke_Width.var instead of .value so the token responds to
CSS-variable overrides (check the area.style.data object and replace the .value
usage on strokeWidth with .var).

522-528: ⚡ Quick win

Donut variants should use variant-specific stroke tokens to match the per-variant naming convention

Lines 525–526, 539–540, and 553–554 in donutThresholdDynamic, donutThresholdStatic, and donutUtilization all reference the base chart_donut_pie_data_stroke_Color and chart_donut_pie_data_stroke_Width tokens. However, each variant already imports its own dimensional tokens (chart_donut_threshold_dynamic_pie_Height, chart_donut_threshold_static_pie_Width, etc.), establishing a per-variant naming convention. The stroke tokens should follow the same pattern to allow independent customization per variant—for example, chart_donut_threshold_dynamic_pie_data_stroke_Color for donutThresholdDynamic.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts`
around lines 522 - 528, The donut variants (donutThresholdDynamic,
donutThresholdStatic, donutUtilization) are incorrectly using the generic
chart_donut_pie_data_stroke_Color and chart_donut_pie_data_stroke_Width tokens;
update each variant to use its own per-variant stroke tokens (e.g., replace
chart_donut_pie_data_stroke_Color and chart_donut_pie_data_stroke_Width in
donutThresholdDynamic with chart_donut_threshold_dynamic_pie_data_stroke_Color
and chart_donut_threshold_dynamic_pie_data_stroke_Width respectively) and make
analogous replacements in donutThresholdStatic and donutUtilization to use
chart_donut_threshold_static_pie_data_stroke_* and
chart_donut_utilization_pie_data_stroke_* tokens so each variant can be
customized independently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts`:
- Around line 60-61: The imports for six missing token modules
(chart_legend_data_stroke_Color, chart_legend_data_stroke_Width,
chart_donut_pie_data_stroke_Color, chart_donut_pie_data_stroke_Width,
chart_bullet_bar_stroke_Color, chart_bullet_bar_stroke_Width) are invalid and
will break the build; either add corresponding token files to
`@patternfly/react-tokens` exporting these symbols, or remove/replace their
imports in base-theme.ts: update the import list to stop importing those six
identifiers and adjust any usages in ChartTheme (e.g., where
chart_legend_data_stroke_Color / _Width, chart_donut_pie_data_stroke_*,
chart_bullet_bar_stroke_*) to use existing tokens or explicit values so no
unresolved module paths remain.

In `@packages/react-core/src/components/Hero/Hero.tsx`:
- Line 38: The Hero component removed the hasNoGlass prop from the
typed/destructured props but still spreads ...props onto the outer <div>,
causing hasNoGlass to leak to the DOM and breaking the public API; restore
support by re-introducing hasNoGlass into the component props (and its
TypeScript interface) and destructure it out of props (e.g. function Hero({
hasNoGlass, ...props }) or the existing props interface) so you can consume it
internally and not pass it through the ...props spread, or if you intend to
deprecate it, explicitly handle it and strip it before spreading while marking
it deprecated in the props type/comment; update references to hasNoGlass inside
Hero accordingly (and ensure tests/types reflect the restored prop).

---

Nitpick comments:
In
`@packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts`:
- Around line 175-178: The area style's data block uses
chart_area_stroke_Width.value for strokeWidth while fillOpacity was migrated to
chart_area_Opacity.var; update the area.style.data property named strokeWidth to
use chart_area_stroke_Width.var instead of .value so the token responds to
CSS-variable overrides (check the area.style.data object and replace the .value
usage on strokeWidth with .var).
- Around line 522-528: The donut variants (donutThresholdDynamic,
donutThresholdStatic, donutUtilization) are incorrectly using the generic
chart_donut_pie_data_stroke_Color and chart_donut_pie_data_stroke_Width tokens;
update each variant to use its own per-variant stroke tokens (e.g., replace
chart_donut_pie_data_stroke_Color and chart_donut_pie_data_stroke_Width in
donutThresholdDynamic with chart_donut_threshold_dynamic_pie_data_stroke_Color
and chart_donut_threshold_dynamic_pie_data_stroke_Width respectively) and make
analogous replacements in donutThresholdStatic and donutUtilization to use
chart_donut_threshold_static_pie_data_stroke_* and
chart_donut_utilization_pie_data_stroke_* tokens so each variant can be
customized independently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2d0d264f-f37a-47f3-b01f-f84bbf4bd76c

📥 Commits

Reviewing files that changed from the base of the PR and between 4656548 and 4289820.

📒 Files selected for processing (2)
  • packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts
  • packages/react-core/src/components/Hero/Hero.tsx

Comment thread packages/react-core/src/components/Hero/Hero.tsx Outdated
@mcoker mcoker requested a review from lboehling May 8, 2026 06:15
@mcoker mcoker requested a review from dlabrecq May 11, 2026 14:08
Copy link
Copy Markdown
Member

@dlabrecq dlabrecq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, but concerned about CodeRabbit's base-theme comment regarding missing token module files. Guessing that's because react-tokens needs to be updated first? Whenever that's ready, I'd like to run the examples to verify the new BaseComponentTheme properties

Comment on lines +471 to +478
},
scatter: {
style: {
data: {
stroke: chart_bullet_bar_stroke_Color.var,
strokeWidth: chart_bullet_bar_stroke_Width.var
}
}
Copy link
Copy Markdown
Member

@dlabrecq dlabrecq May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the scatter props. This is new here and need to test visually

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dlabrecq as far as I can tell, the coderabbit comment about imports was just out of date. The build and everything was passing and all of the visual regression tests passed. I requested a re-review and it resoled that comment and didn't flag it again.

Not sure about the scatter props. This is new here and need to test visually

You can see that one here - https://pf-react-pr-12419.surge.sh/components/charts/bullet-chart#primary-measure-dot

Screenshot 2026-05-11 at 1 37 33 PM

@mcoker
Copy link
Copy Markdown
Contributor Author

mcoker commented May 11, 2026

@coderabbitai can you re-review this PR?

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

@mcoker Sure! I'll kick off a full re-review of this PR now.

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts (1)

504-557: ⚡ Quick win

Extract duplicated donut stroke style into a shared constant.

Line 510–Line 515, Line 523–Line 528, Line 537–Line 542, and Line 551–Line 556 repeat the same style.data object. Pulling this into a constant will reduce drift risk when token mappings change again.

♻️ Suggested refactor
+const DONUT_PIE_DATA_STROKE_STYLE = {
+  data: {
+    stroke: chart_donut_pie_data_stroke_Color.var,
+    strokeWidth: chart_donut_pie_data_stroke_Width.var
+  }
+};

  donut: {
    pie: {
      height: chart_donut_pie_Height.value,
      padding: chart_donut_pie_Padding.value,
      padAngle: chart_donut_pie_angle_Padding.value,
      width: chart_donut_pie_Width.value,
-      style: {
-        data: {
-          stroke: chart_donut_pie_data_stroke_Color.var,
-          strokeWidth: chart_donut_pie_data_stroke_Width.var
-        }
-      }
+      style: DONUT_PIE_DATA_STROKE_STYLE
    } as any
  },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts`
around lines 504 - 557, The pie charts for donut, donutThresholdDynamic,
donutThresholdStatic, and donutUtilization all repeat the same style.data object
(using chart_donut_pie_data_stroke_Color.var and
chart_donut_pie_data_stroke_Width.var); extract that object into a shared
constant (e.g., const donutStrokeStyle = { data: { stroke:
chart_donut_pie_data_stroke_Color.var, strokeWidth:
chart_donut_pie_data_stroke_Width.var } }) and replace each pie.style with a
reference to that constant (pie.style = donutStrokeStyle) so the four
occurrences in the pie configs (inside donut, donutThresholdDynamic,
donutThresholdStatic, donutUtilization) reuse the single constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts`:
- Around line 504-557: The pie charts for donut, donutThresholdDynamic,
donutThresholdStatic, and donutUtilization all repeat the same style.data object
(using chart_donut_pie_data_stroke_Color.var and
chart_donut_pie_data_stroke_Width.var); extract that object into a shared
constant (e.g., const donutStrokeStyle = { data: { stroke:
chart_donut_pie_data_stroke_Color.var, strokeWidth:
chart_donut_pie_data_stroke_Width.var } }) and replace each pie.style with a
reference to that constant (pie.style = donutStrokeStyle) so the four
occurrences in the pie configs (inside donut, donutThresholdDynamic,
donutThresholdStatic, donutUtilization) reuse the single constant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 01a8dc0f-fc17-45b6-b921-6ad51c299a60

📥 Commits

Reviewing files that changed from the base of the PR and between 57fe8ee and 8d02694.

⛔ Files ignored due to path filters (29)
  • packages/react-charts/src/victory/components/Chart/__snapshots__/Chart.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartArea/__snapshots__/ChartArea.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartAxis/__snapshots__/ChartAxis.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartBar/__snapshots__/ChartBar.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartBoxPlot/__snapshots__/ChartBoxPlot.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartBullet/__snapshots__/ChartBullet.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartBullet/__snapshots__/ChartBulletGroupTitle.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartBullet/__snapshots__/ChartBulletPrimaryDotMeasure.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartBullet/__snapshots__/ChartBulletPrimarySegmentedMeasure.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartBullet/__snapshots__/ChartBulletQualitativeRange.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartContainer/__snapshots__/ChartContainer.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartCursorContainer/__snapshots__/ChartCursorContainer.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartCursorTooltip/__snapshots__/ChartCursorFlyout.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartCursorTooltip/__snapshots__/ChartCursorTooltip.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartDonut/__snapshots__/ChartDonut.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartDonutUtilization/__snapshots__/ChartDonutThreshold.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartDonutUtilization/__snapshots__/ChartDonutUtilization.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartGroup/__snapshots__/ChartGroup.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartLegend/__snapshots__/ChartLegend.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartLegendTooltip/__snapshots__/ChartLegendTooltip.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartLine/__snapshots__/ChartLine.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartPie/__snapshots__/ChartPie.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartPoint/__snapshots__/ChartPoint.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartScatter/__snapshots__/ChartScatter.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartStack/__snapshots__/ChartStack.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartThreshold/__snapshots__/ChartThreshold.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartTooltip/__snapshots__/ChartTooltip.test.tsx.snap is excluded by !**/*.snap
  • packages/react-charts/src/victory/components/ChartVoronoiContainer/__snapshots__/ChartVoronoContainer.test.tsx.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • packages/react-charts/src/echarts/components/themes/colors/skeleton-theme.ts
  • packages/react-charts/src/victory/components/ChartTheme/themes/base-theme.ts
  • packages/react-charts/src/victory/components/ChartTheme/themes/colors/skeleton-theme.ts
  • packages/react-charts/src/victory/components/ChartTheme/themes/skeleton-theme.ts
  • packages/react-core/package.json
  • packages/react-docs/package.json
  • packages/react-icons/package.json
  • packages/react-styles/package.json
  • packages/react-tokens/package.json

Copy link
Copy Markdown
Collaborator

@lboehling lboehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small nit -- can we update the stroke around the bar charts to use border--color--alt instead of high-contrast border color? (regular & stacked -- i think they reference the same var, i just can't find it in the diff)

otherwise this all looks great to me!

@mcoker mcoker requested a review from dlabrecq May 11, 2026 18:38
@mcoker
Copy link
Copy Markdown
Contributor Author

mcoker commented May 11, 2026

@dlabrecq thanks! Everything is ready, let me know if you're trying to access something and it isn't working.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants