Skip to content

Add color setting for calendar entities#28882

Merged
MindFreeze merged 11 commits into
home-assistant:devfrom
Misiu:color
Jan 27, 2026
Merged

Add color setting for calendar entities#28882
MindFreeze merged 11 commits into
home-assistant:devfrom
Misiu:color

Conversation

@Misiu
Copy link
Copy Markdown
Contributor

@Misiu Misiu commented Jan 8, 2026

Breaking change

Proposed change

Add color setting for calendar entities for home-assistant/core#145606, similar to home-assistant/core#88139

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Comment thread src/panels/lovelace/cards/hui-calendar-card.ts Outdated
@MindFreeze MindFreeze marked this pull request as draft January 19, 2026 06:06
@MindFreeze
Copy link
Copy Markdown
Member

Drafting until the comment and Core PR are resolved

@Misiu
Copy link
Copy Markdown
Contributor Author

Misiu commented Jan 20, 2026

As mentioned in home-assistant/core#145606, I think that backend changes aren't needed as the color is stored in the entity registry.
Docs PR: home-assistant/developers.home-assistant#2919 that describes color management for calendars.
I've added spinner and color synchronization, so the calendar card updates automatically when, for example, you change color in a second browser.
This change in the frontend is bigger than I expected, and I think there's a better way to do it, but as I'm not a frontend developer, I wasn' table to create something simpler. I've tried using Gemini 3 Pro and Claude Sonnet 4.5 to simplify the changes, but it didn't create anything useful, so feedback is more than welcome

@MindFreeze
Copy link
Copy Markdown
Member

I simplified it a bit.
I think we do need the core changes or the color setting will be rejected by validation.

@Misiu
Copy link
Copy Markdown
Contributor Author

Misiu commented Jan 21, 2026

Thank you for your time and for the changes.
I've started Core from dev (no changes from my branch), and everything worked fine. Not sure what validation needs to be changed/added.

@Misiu
Copy link
Copy Markdown
Contributor Author

Misiu commented Jan 21, 2026

I've added color to Google Calendar - home-assistant/core@b085d37. It works just fine with this PR.

The latest changes simplify things a bit; now the frontend requires a hex string, so the color can be correctly seen in entity options

@Misiu
Copy link
Copy Markdown
Contributor Author

Misiu commented Jan 27, 2026

Backend PR is approved

@Misiu Misiu marked this pull request as ready for review January 27, 2026 06:30
MindFreeze
MindFreeze previously approved these changes Jan 27, 2026
Comment thread src/panels/lovelace/cards/hui-calendar-card.ts Outdated
@Misiu
Copy link
Copy Markdown
Contributor Author

Misiu commented Jan 27, 2026

@MindFreeze thank you for the review.
This works, but I believe there are a lot of changes in the code.
Maybe there is a better/simpler way to load colors from the entity registry. Especially in hui-calendar-card.ts and ha-panel-calendar.ts
I intended to avoid changing the colors while loading (at first, the color was calculated by index, then changed when values were loaded from the entity registry), but also to update the color on cards as soon as entity options are changed.

Maybe there is an easy way to simplify this code?

@Misiu Misiu requested a review from MindFreeze January 27, 2026 08:14
Copy link
Copy Markdown
Member

@MindFreeze MindFreeze left a comment

Choose a reason for hiding this comment

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

I added SubscribeMixin to simplify a bit more. Don't see what more can be done so I'm going to call it good enough. Thanks

@MindFreeze MindFreeze enabled auto-merge (squash) January 27, 2026 08:52
@MindFreeze MindFreeze merged commit 30eb50a into home-assistant:dev Jan 27, 2026
10 checks passed
@karwosts karwosts mentioned this pull request Feb 8, 2026
9 tasks
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.

3 participants