Add FrontendColors enum generated from the frontend theme - #5372
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an automated pipeline to mirror Home Assistant frontend theme CSS custom properties into a generated Swift enum (with light/dark raw values and runtime color resolution), plus CI automation to keep it updated.
Changes:
- Add
Tools/BuildFrontendColors.pygenerator that fetches/parsescolor.globals.tsand writesFrontendColors.swift. - Add Swift helpers to resolve hex/rgb(a)/var() CSS values into
SwiftUI.Color, plus unit tests. - Add a scheduled GitHub Actions workflow to auto-regenerate and open a PR when colors change.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tools/BuildFrontendColors.py | New generator script that fetches/parses frontend theme colors and renders Swift output. |
| Sources/HADesignSystem/Sources/Colors/FrontendColors.swift | Generated enum + light/dark raw-value mappings for CSS custom properties. |
| Sources/HADesignSystem/Sources/Colors/FrontendColors+Color.swift | Adds runtime parsing/resolution for CSS-like color values into SwiftUI colors. |
| Tests/Shared/DesignSystem/FrontendColorsTests.swift | Validates raw values and selected resolution behaviors (hex, var(), fallback, rgba). |
| .github/workflows/update_frontend_colors.yml | Scheduled workflow to regenerate the file and open an automated PR. |
bgoncal
force-pushed
the
bgoncal/frontend-colors-enum
branch
from
August 6, 2026 17:05
55ae511 to
6e95940
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI Policy
Select exactly one option that describes AI usage in this contribution:
Summary
Adds a
FrontendColorsenum mirroring the frontend theme color custom properties (color.globals.ts), generated byTools/BuildFrontendColors.py, plus a weekly workflow that regenerates it and opens a PR when the palette changes.Screenshots
N/A – no user-facing UI change.
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
The generated file is committed; run
Tools/BuildFrontendColors.pyto regenerate locally.