Skip to content

TP-05 — Map shadcn_colors to ColorScheme #100

Description

@ZhuchkaTriplesix

Epic: A
Depends on: TP-04

Source: docs/theme-parser-github-issues.md

Goal

Convert custom shadcn_colors into shadcn_flutter.ColorScheme with fallback values.

Files

  • lib/core/theme/parser/querya_theme_color_scheme.dart
  • test/core/theme/parser/querya_theme_color_scheme_test.dart

Implementation

Add pure function:

ColorScheme colorSchemeFromQueryaThemeColors({
  required Map<String, String> colors,
  required QueryaTheme fallback,
});

Map these keys:

  • background
  • foreground
  • card
  • cardForeground
  • popover
  • popoverForeground
  • primary
  • primaryForeground
  • secondary
  • secondaryForeground
  • muted
  • mutedForeground
  • accent
  • accentForeground
  • destructive
  • destructiveForeground
  • border
  • input
  • ring
  • chart1
  • chart2
  • chart3
  • chart4
  • chart5

Fallback:

  • missing key -> fallback colorScheme value;
  • invalid optional color -> fallback value;
  • debug log invalid optional key if useful.

Acceptance Criteria

  • Function is pure.
  • Missing optional keys preserve fallback.
  • Full fixture maps distinct expected values.
  • Brightness comes from fallback theme, not from colors map.

Tests

  • full map uses custom values;
  • missing keys use fallback;
  • invalid optional color uses fallback;
  • chart colors fallback correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    parserTheme parser epic label: parserthemeTheming, colors, VS Code themes

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions