# Can you create an enum tag that changes text and color based on an integer?

**URL:** <https://forum.inductiveautomation.com/t/can-you-create-an-enum-tag-that-changes-text-and-color-based-on-an-integer/116950>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 31, 2026, 6:21pm UTC](https://forum.inductiveautomation.com/t/can-you-create-an-enum-tag-that-changes-text-and-color-based-on-an-integer/116950 "2026-08-31T18:21:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfox37](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@dfox37](https://forum.inductiveautomation.com/u/dfox37)\
**Post date:** [August 31, 2026, 6:21pm UTC](https://forum.inductiveautomation.com/t/can-you-create-an-enum-tag-that-changes-text-and-color-based-on-an-integer/116950/1 "2026-08-31T18:21:11Z")

</div>

In perspective I created an enum tag that changes text when a PLC integer tag changes state. So 0 = off, 1 = run, 2 = alarm and so on. Can I also have it change color? I tried stacking "map" transforms but it made a mess. I either had the enum spitting out the actual color hex number x000000 or all of the text stayed black. I don't want to go too crazy on this with a bunch of scripting. I guess I could go old school and stack them on top of each other with visibility settings. Any ideas?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [August 31, 2026, 6:27pm UTC](https://forum.inductiveautomation.com/t/can-you-create-an-enum-tag-that-changes-text-and-color-based-on-an-integer/116950/2 "2026-08-31T18:27:03Z")

</div>

I'm making the assumption that you are displaying the tag value in a label or similar component.

The best practice approach to this is to define enum state colors in your project's Style Classes, and then apply a binding to the display label's `textStyle.classes` property with a map transform set to return style classes and map accordingly to the values of the integer.

This method provides a single point of truth for all of your enum state colors.

> **[Output Type​ - Map Transform | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.3/ignition-modules/perspective/working-with-perspective-components/bindings-in-perspective/transforms/map-transform#output-type)**
>
> The Map Transform allows you to set up a map of input values to output values. Inputs can be anything from specific values or strings, to numeric ranges of values. Each input value can then be mapped to an output value, which can be a string,...

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 1, 2026, 3:10pm UTC](https://forum.inductiveautomation.com/t/can-you-create-an-enum-tag-that-changes-text-and-color-based-on-an-integer/116950/3 "2026-09-01T15:10:43Z")

</div>

Going a step further, also defining expression tags that do the translation to text for your enumerated word tag, and using that tag to drive the style class to choose, ideally by just combining a fixed path with the enum text value (like `"Device/Symbol/" + {view.custom.statusDesc}` where the status desc prop is bound to your enum text tag) so you don't have _any_ map transforms in your ui. Map Transforms are essentially magic numbers. They're configuration that most likely should be centralised, not duplicated where needed.

Edit: The other benefit to binding to the text tag is that it decouples the value from the colour, and binds the colour to its text description. Not all the time do enum values get mapped the same (ideally they should, but we all know how projects go over time with multiple integrators), and you may eventually end up having to incorporate two enum tags that map to the same set of text, but each are mapped differently. Binding the colour to the text eliminates any need to go pulling your hair out making allowances in multitudes of graphics to allow for it
