Skip to content

Add FrontendColors enum generated from the frontend theme - #5372

Merged
bgoncal merged 1 commit into
mainfrom
bgoncal/frontend-colors-enum
Aug 6, 2026
Merged

Add FrontendColors enum generated from the frontend theme#5372
bgoncal merged 1 commit into
mainfrom
bgoncal/frontend-colors-enum

Conversation

@bgoncal

@bgoncal bgoncal commented Aug 6, 2026

Copy link
Copy Markdown
Member

AI Policy

Select exactly one option that describes AI usage in this contribution:

  • I have not used AI for this contribution.
  • AI assistance was used for this contribution.
  • AI fully generated the code for this contribution, but I've reviewed and understood it before submitting and will respond without AI during review.

Summary

Adds a FrontendColors enum mirroring the frontend theme color custom properties (color.globals.ts), generated by Tools/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.py to regenerate locally.

Copilot AI lite review requested due to automatic review settings August 6, 2026 16:39
@bgoncal
bgoncal enabled auto-merge (squash) August 6, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py generator that fetches/parses color.globals.ts and writes FrontendColors.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.

Comment thread Tools/BuildFrontendColors.py Outdated
Comment thread Tools/BuildFrontendColors.py Outdated
@bgoncal
bgoncal force-pushed the bgoncal/frontend-colors-enum branch from 55ae511 to 6e95940 Compare August 6, 2026 17:05
@bgoncal
bgoncal merged commit b4ec146 into main Aug 6, 2026
6 of 11 checks passed
@bgoncal
bgoncal deleted the bgoncal/frontend-colors-enum branch August 6, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants