How to change line colour in lovelace history graph

I’ve done my best searches, but I can’t seem to figure out how to change the line colour for the history graph.
Is this possible? maybe I need to do it via themes?


I’ve been looking for this for ages. It becomes really important when you have multiple sensors on the same graph. There’s no way to keep the colors consistent between graphs.


Try this. But there are some things I like about the history graph. Works pretty well for thermostats and I like the axis etc…

Thanks for the tip but I’ve tried that. It is too “dumbed down” for what I am looking for. The history graph is almost perfect, just missing the ability to set the color for the different inputs. It would really be nice to change the order and color.

Did you find an answer to changing the line color by any chance, i’m looking for that desperately too :frowning:

I think configurable graph colors would be awesome.

Found a feature request post for it to be added. And voted for it.

More votes would help with the request.


I’ve voted…
@ubhits ~ nope :frowning:

Up voted as well.

Yes, but that was dated 2016!

Personally, I’d like to see more development work on “core” functions like this, and less on things like toilet seat integrations. This project is getting a bit top-heavy, and the foundation is starting to show cracks.


Shortly after voting for the graph color option. I stumbled upon Lovelace: mini graph card .

I’ve not had the chance to try it out.
However after reading on the setup/usage I’m Sure it can change the color of the graph line, and more if wanted.

A posting about color change of the graph.

I think at some point, when the community add-on is ready. It will be added to the core of HA. Just a guess and sort of a hope.


Mini graph card is great. You can even have variable color change. However it doesn’t have an option to show time for the x-axis which I’d like added


Hello guys,

I want to ask if there are any possibilities to change the colors for each signals shown in “History” tab. Currently, I have a DSC alarm panel, which send few signals thru MQTT, like: Zone 1, Zone 2, Alarm Status, etc.
In my case, the “Zone 2” represents a Motion sensor, and when there is no motion in front of the sensor, the HA shows the message “Clear” (which is true) and is marked in red color. In case there is any motion, the message is changed to “Detected” and displays a green color.
Now, for me makes more sense to have the colors reversed, when it can be detected any motion, to show the red color, and when there is no motion, to display the green color. Same for “Security Trouble” signal, I would see it green when the status is “OK” and there are no problems.

Some of you have any idea about this ?


Why oh why does history_graph not use the same colour rules for entities with ‘device_class: presence’ and entities of device_tracker. Both show text states of Home / Away.

I vote for history graph. it would be nice to have production from solar PV in green and
consumption in red. if you have any suggestions on two sensors with timeline please advise. Previously i have used grafana but it is too heavy for Rasberry PI. Thank you in advance.

1 Like

@pils330 - Would you mind showing me the code for one of your CO2 graphs? I can’t get it exactly like the one you have.


Hi pil330,

same here - would be interested of the code you used for the graph (colouring).
Would you mind to share?

Tank you.

See post #3

even though months later I still miss pieces to get it right

Could you provide some code please ?

that would be awsome :grinning:


Be sure to check out Apex charts for anyone still experiencing limitations listed in the thread.

It has most bases covered.

1 Like

That looks amazing. I’d been trying to avoid adding HACS to my HA, for simplicity/stability reasons, but I really don’t think I can resist this…