-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(ui): migrate all components to dynamic palette system #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Eliminate palette data duplication by consolidating all palette definitions
into src/lib/config/palettes/ as TypeScript modules. This refactor addresses
all requirements from MVP task 2.1.
Key changes:
- Move palette definitions from docs/dev/ref/palettes/ to src/lib/config/palettes/
- Create paletteTransformer.ts to separate data from transformation logic
- Update paletteTypes.ts to use rich semantic structure with named colours
- Refactor paletteLoader.ts to import palettes directly (eliminates 78 lines)
- Remove duplicate JSON files
- Add comprehensive documentation at docs/dev/ref/palettes/README.md
Architecture improvements:
- Single source of truth: src/lib/config/palettes/{workflow}Palette.ts
- Transformation layer: src/lib/utils/palette/paletteTransformer.ts
- Human-readable semantic structure with colour names (e.g., "bronze", "teal")
- Type-safe with PaletteStructure interface
- Clear separation of concerns (data vs. logic)
Tailwind CSS evaluation: Decided against inclusion as custom system is
sufficient for managing 5 workflow palettes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
…ource
Establish build-time palette generation as core architecture to enforce single
source of truth principle. All colour values now flow from TypeScript palette
files through automated build script to generated CSS consumed by components.
Key additions:
- Build script (scripts/generatePaletteCss.js) parses TypeScript palette files
- Generates palettes.generated.css with workflow-specific CSS variables
- Auto-runs before build and dev via package.json scripts
- Hub screen now uses generated palette variables instead of hardcoded hex
Architecture:
- Source: src/lib/config/palettes/*.ts (TypeScript palette definitions)
- Build: scripts/generatePaletteCss.js (regex parser + CSS generator)
- Output: src/lib/styles/palettes.generated.css (75+ CSS custom properties)
- Usage: Components reference --{workflow}-{property} variables
Benefits:
- Zero manual synchronisation between TypeScript and CSS
- Change palette once, updates propagate automatically
- Build-time generation means zero runtime overhead
- Type-safe palette definitions with runtime CSS generation
Documentation:
- BUILD-TIME-GENERATION.md explains system architecture and workflow
- Details troubleshooting, migration path, and critical do/don't rules
This establishes the foundation for converting remaining 650+ hardcoded
colours across components to use the palette system.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Complete migration of all Metis workflow components from hardcoded colour values to CSS palette variables, following build-time generation architecture. - Convert FileUpload.svelte success/error states to palette variables - Convert StructuredInputForm.svelte validation and button colours - Convert ModulePreview.svelte status indicators to use palette system - Convert ChangelogViewer.svelte confidence badges and warnings - Add PALETTE-MIGRATION-STATUS.md to track conversion progress - Regenerate palettes.generated.css with latest build script All Metis components now use var(--palette-*) variables ensuring automatic palette propagation when switching workflows. Replaces ~30 hardcoded hex values with semantic palette references. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Systematically convert CourseConfigForm, ArcStructurePlanner, ModuleStructurePlanner, and ModuleWithinArcPlanner from hardcoded colour values to CSS palette variables. Converted Components: - CourseConfigForm.svelte: 2 rgba values to color-mix - ArcStructurePlanner.svelte: 5 hardcoded colours - ModuleStructurePlanner.svelte: 25 hardcoded colours - ModuleWithinArcPlanner.svelte: 30 hardcoded colours Total: ~62 hardcoded values replaced with semantic palette references. All components now use var(--palette-*) ensuring automatic palette propagation. Build verified with no errors. Progress: 26% complete (17/35 files, 167 values converted) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…ables Completed palette variable conversion for final 3 Themis components: - ModuleGenerationList: Converted status colours and error styling (9 values) - CourseOverview: Converted status banners and error states (9 values) - CourseStructureReview: Already using palette variables All 7 Themis components now use dynamic palette system. Status colour function returns CSS variables instead of hardcoded hex values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Completed palette variable conversion for all 3 Theia components: - CourseStructureUpload: Converted drag/drop states, warnings, and status indicators (30 colour values) - ExportButton: Converted button variants (6 colour values) - ExportConfigModal: Converted modal styling, form controls, and buttons (40 colour values) All Theia components now use dynamic palette system for consistent theming. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Completed palette variable conversion for both error components: - ErrorBoundary: Converted fallback text colour (1 value) - ErrorAlert: Converted all severity states, buttons, and details panel (17 colour values) ALL 35 component files now use the dynamic palette system! This completes the component conversion phase of the palette migration. Next: Visual testing and final integration verification. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
CourseStructureReview was already partially using palette variables, but had ~80 remaining hardcoded colours. This commit converts all remaining: - Loading state spinner and text colours - Error state styling and buttons - Review header and descriptions - Arc container styling and hover states - Module cards, badges, and form controls - Navigation buttons and shadows All Themis components now fully use the dynamic palette system. Also updates palettes.generated.css from build-time generation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
SummaryThis PR successfully completes the palette system migration by converting all 35 component files to use dynamic CSS custom properties. The implementation establishes a solid build-time generation architecture with TypeScript palette files as the single source of truth. While the code quality and architecture are excellent, there are opportunities to improve the regex-based parsing approach and add test coverage. Code Quality & Best PracticesExcellent:
Suggestions:
Potential IssuesMedium Priority:
Low Priority:
PerformanceExcellent:
SecurityNo Issues Identified:
Test CoverageCurrent State: No tests Recommendations:
The build script parsing is fragile (regex-based) and needs a safety net. RecommendationApprove with suggestions for follow-up. This is excellent work:
Before Merge (if possible):
Follow-up Issues (post-merge):
Great job on the architecture and execution! The separation of concerns and documentation are particularly well done. |
Summary
Completes the palette system migration by converting all 35 component files to use dynamic CSS custom properties instead of hardcoded colour values. This establishes TypeScript palette files as the single source of truth for all UI colours.
What Changed
Build Infrastructure (Previously Completed)
devandbuildComponent Conversions (This PR)
Metis Components (4 files) - 30 colour values
Themis Components (7 files) - ~160 colour values
Theia Components (3 files) - 76 colour values
Error Components (2 files) - 18 colour values
Total Impact
Key Benefits
src/lib/config/palettes/*.tsTechnical Details
Colour Mapping Patterns
var(--palette-foreground)var(--palette-primary)var(--palette-accent)var(--palette-foreground-alt)var(--palette-line)var(--palette-bg-subtle)Example Conversion
Testing
Documentation
Updated
docs/dev/ref/palettes/PALETTE-MIGRATION-STATUS.mdwith:Migration Status
Components: 35/35 ✅ (100%)
See full migration details in:
/docs/dev/ref/palettes/PALETTE-MIGRATION-STATUS.md🤖 Generated with Claude Code