Skip to content

fix: hardcoded chart colors in PrototypeLibraryPortfolio break dark mode #417

Description

@NhanLuongBGSV

Context

In PR #413, chart datalabel colors in PrototypeLibraryPortfolio.tsx were changed from CSS variables to hardcoded hex values to work around Chart.js datalabels plugin not resolving hsl(var(...)) strings.

Problem

Hardcoded colors (#f3f4f6, #d1d5db, #374151) won't adapt to dark mode or custom themes.

File: frontend/src/components/organisms/PrototypeLibraryPortfolio.tsx (lines 220-230)

Current workaround

The hovered state already uses getCSSVariable('--primary') which works. Only the non-hovered states are hardcoded.

Suggested fix

Use getCSSVariable() for all color properties, same pattern as the hover state:

backgroundColor: (context) =>
  context.dataIndex === hoveredIndex
    ? `hsl(${getCSSVariable('--primary')})`
    : `hsl(${getCSSVariable('--muted')})`,
borderColor: `hsl(${getCSSVariable('--border')})`,
color: (context) =>
  context.dataIndex === hoveredIndex
    ? '#ffffff'
    : `hsl(${getCSSVariable('--muted-foreground')})`,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions