Skip to content

fix: pie chart custom label dark mode support#10223

Open
mahmoodhamdi wants to merge 1 commit intoshadcn-ui:mainfrom
mahmoodhamdi:fix/pie-chart-dark-mode-label
Open

fix: pie chart custom label dark mode support#10223
mahmoodhamdi wants to merge 1 commit intoshadcn-ui:mainfrom
mahmoodhamdi:fix/pie-chart-dark-mode-label

Conversation

@mahmoodhamdi
Copy link
Copy Markdown

What

Fixed the custom label in chart-pie-label-custom not being visible in dark mode.

Why

The <text> element used fill="var(--foreground)" as an SVG attribute, which doesn't respond to dark mode theme changes. In dark mode, the label text remains dark-colored against the dark background, making it invisible.

How

Replaced fill="var(--foreground)" with className="fill-foreground" (Tailwind utility class), which is the established pattern used by other chart label examples:

  • chart-bar-label.tsx
  • chart-bar-label-custom.tsx
  • chart-line-label.tsx
  • chart-line-label-custom.tsx

Testing

  • Verified the label renders correctly in both light and dark mode
  • Consistent with the approach used across all other chart label examples

Closes #9703

Replace fill="var(--foreground)" with className="fill-foreground"
in chart-pie-label-custom to properly support dark mode, consistent
with other chart label examples (chart-bar-label, chart-line-label).

Closes shadcn-ui#9703
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 29, 2026

@mahmoodhamdi is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

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.

[bug]: chart-pie-label-custom do not support dark mode.

1 participant