History graph card: allow color customization for "line" graphs#51802
Open
ildar170975 wants to merge 14 commits intohome-assistant:devfrom
Open
History graph card: allow color customization for "line" graphs#51802ildar170975 wants to merge 14 commits intohome-assistant:devfrom
ildar170975 wants to merge 14 commits intohome-assistant:devfrom
Conversation
This was referenced May 1, 2026
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.
Breaking change
Proposed change
Currently the only way to customize colors in
history-graph(particularly – for linearstate-history-chart-line) – defining--graph-colorvariables in a custom theme.But this way has limitations:
-- cannot customize colors only for a particular card (unless card-mod is used);
-- cannot customize a color for a particular entity, a color depends on an index.
There were many requests in Community for adding a possibility to define colors in the
history-graphconfig directly.Related:
#18494
https://community.home-assistant.io/t/changing-colors-of-the-history-graph/219535
#11054
#11188
https://github.com/orgs/home-assistant/discussions/168
This PR contains:
coloroption inhistory-graphcard.colorinput field added in UI editor.colorinput field is disabled for assumingly not-numerical entities. Means – colors can be only defined for assumingly numerical entities: forcounter/input_number/numberdomains, for sensors with definedunit_of_measurement&state_classattributes, butsensorNumericDeviceClassesis not accounted for simplicity. Anyway, if a user defines thecoloroption for a timeline graph – this option will not be accounted as meaningless. Similarly, thecoloroption cannot be defined forclimate&water_heaterentities due to a complex presentation, a default colors generation is used.coloroption is optional. If it is not defined for some entity – a default color generation is used for this entity.history-graphcard are automatically placed in yaml in a correct consistent order.coloroption in yaml:lightgreen(web color),light-green(HA theme color transformed into--light-green-colorCSS var and then resolved from a current theme),#ff00ff(hex),rgb(0,0,255)(RGB). Note that aredcolor will be processed as a--red-colorvariable (a value may differ from aredweb color).Similar - for Statistics graph card: #51824
Docs are updated - home-assistant/home-assistant.io#45123.
UI editor (layout can be changed due to #51749):

Default & customized colors:

Different color formats used in yaml:

History + statistics:

Disabled color option:

Screenshots
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
To help with the load of incoming pull requests: