# Perspective style color linked to tag?

**URL:** <https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [August 15, 2024, 5:27pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710 "2024-08-15T17:27:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [August 15, 2024, 5:27pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/1 "2024-08-15T17:27:56Z")

</div>

is there a way to link a tag (string tag with hex color as string) to CSS element ie border-color: tag([default]color/high) Or can you script that tag to update style element on change?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 15, 2024, 5:29pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/2 "2024-08-15T17:29:14Z")

</div>

A simple binding should do it.

---

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [August 15, 2024, 5:33pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/3 "2024-08-15T17:33:16Z")

</div>

I am talking about changing the CSS Styles, not the component style properties on a view

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/a/6a69f0c5bf96415cf32b4a6ce20c3d6d6c9694e5.png)

this example does not work / just for illustration

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 15, 2024, 5:35pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/4 "2024-08-15T17:35:51Z")

</div>

Well then, no you can't.

What are you trying to achieve ? It looks like you're going in the wrong direction.

---

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [August 15, 2024, 5:37pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/5 "2024-08-15T17:37:46Z")

</div>

I want to be able to change the color of several style elements without having to go into the style and change each one.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 15, 2024, 5:38pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/6 "2024-08-15T17:38:33Z")

</div>

No, you can't create a binding on a CSS style. The browser will load the CSS stylesheet with the Ignition Perspective page and it won't be updated unless a complete refresh is done

The way to do this is create your two style classes with styling as required. Then ...

 ![Border binding](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/8/882ebcbb195fc0731917315ee5f8a89f58c3159a.png)

... add a binding to the component's `PROPS.style.classes` and get that to select the appropriate style class based on the tag value.

---

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [August 15, 2024, 5:48pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/7 "2024-08-15T17:48:03Z")

</div>

I get what you are doing there, but for example...

I have styles  
borderFault - border color red  
textFault - text red  
backgroundFault - background red

those styles are used on several different pages and are called similar to what you show.

However new install wants a different color for Fault (purple) I want to be able to change all those "red" to purple without having to go into each style and change them manually / make sure they all get changed to same value.

Its fine if clients need to restart after change as this not be a frequent change.

I think scripting to write to the CSS would work I just haven't seen any way to do it

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 15, 2024, 5:52pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/8 "2024-08-15T17:52:08Z")

</div>

There is no supported way to make the Style Resources dynamic.

> [@rfolkes](#):
>
> However new install wants a different color for Fault (purple) I want to be able to change all those "red" to purple without having to go into each style and change them manually / make sure they all get changed to same value.

Don't use hard coded colors, instead use CSS variables provided by your own theme in either the CSS spreadsheet or a Theme provided to Ignition.

Then you can use `var(YourColorVariable)` for your colors.

This way a new client wants different colors, you modify your theme and everything is modified automagically.

More information here:

> **[Perspective Built-In Themes | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/styles/perspective-built-in-themes)**
>
> Themes

> **[Creating and Using Custom Perspective Themes | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/styles/creating-and-using-custom-perspective-themes)**
>
> Theme Overview

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 15, 2024, 5:52pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/9 "2024-08-15T17:52:51Z")

</div>

There's one "right" answer for this: themes.  
If you can't use themes, you can hack something with the stylesheet.

---

<div class="post-metadata">

**Author:** ![brian.mcenulty](https://avatars.discourse-cdn.com/v4/letter/b/b77776/32.png) [@brian.mcenulty](https://forum.inductiveautomation.com/u/brian.mcenulty)\
**Post date:** [August 15, 2024, 7:57pm UTC](https://forum.inductiveautomation.com/t/perspective-style-color-linked-to-tag/94710/10 "2024-08-15T19:57:24Z")

</div>

+1 to custom themes. Create a custom theme with variable names and just update those variables as needed for individual project requirements.
