Global variables in dashboard


I’ve tried the search but could not find a solution for my problem. In short, I have one dashboard with multiple views/pages for each room based on mushroom and minigraph cards. Each room has their own temperature sensor with a small graph. Every graph has the same color. Orange for temperature and blue for humidity.

type: custom:mini-graph-card
  - sensor.zolder_temperature
points_per_hour: 1.5
hours_to_show: 24
name: Temperature
line_color: orange
line_width: 5
  icon: false

I’m looking for a way to centrally change the color of all graphs without doing search and replace in the yml. I was thinking, is there a possibility to create global variables? I also tried a text helper and then using a template to fetch the value of the text helper but that also doesn’t work. Any tips on how I could achieve this?

3 ways.

  1. Keep colors as secrets, use “color: !secret color_humidity”. Works in yaml mode only.
  2. Keep colors in separate fileS, then use “color: !include …/color_humidity.yaml”. Works in yaml mode only; also it is rather silly to use a separate file for one value.
  3. Keep colors inside a custom theme as variables, then use “color: var(- -my-color-humidity”. Works in yaml mode only, requires a custom theme.

Seems like referring other files or secrets does not work in a lovelace dashboard. Any !include or !secret is just not accepted.
Looks like this FR is what I am looking for but it has been there for quiet some time

If you want to use a storage mode - then you will miss many yaml-only features. But discussing them is an off-topic here.
Supporting templates in mini-graph-card is not going to happen soon.
There is also a card-mod way - but it does not make sense for a static color, just a waste of card-mod resources. Anyway, if you wish: go to card-mod thread - 1st post - link at the bottom - mini-graph-card - how to change color dynamically.

Just noticed - made a copy/paste error , the 3rd method works in storage mode of course )))