Using color variable from theme instead of hardcoding color code

Is there a way to grab a variable from the current theme and use it in an icon color template/lovelace card instead of hardcoding the color code?

Yepp! For example:
theme.yaml

my-orange: "#ff9800"

lovelace card

              - entity: sensor.hacs
                name: Updates
                style: |
                  :host {
                    {% if states(config.entity)|int > 0 %}
                      --paper-item-icon-color: var(--my-orange);
                    {% endif %};
                  }

Thanks. How do I use it in a icon_color template like with custom-ui?