# Changing Background Color of Label Based On Tag Value Matching Date in Perspective

**URL:** <https://forum.inductiveautomation.com/t/changing-background-color-of-label-based-on-tag-value-matching-date-in-perspective/93189>\
**Category:** Ignition\
**Tags:** perspective, vision, scripting\
**Created:** [July 13, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/changing-background-color-of-label-based-on-tag-value-matching-date-in-perspective/93189 "2024-07-13T14:53:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AydHA](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@AydHA](https://forum.inductiveautomation.com/u/AydHA)\
**Post date:** [July 13, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/changing-background-color-of-label-based-on-tag-value-matching-date-in-perspective/93189/1 "2024-07-13T14:53:02Z")

</div>

I have a script that works on vision for changing a background color from gray to a blue based on if the date of a tag matches the current date.

Now, I have restructured that code and I have been testing to see if I can get it to change the background color of some text, unsuccessfully.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/0/a02a34f7c8a2893676cb5b48e9a87f77696c86b9.png)  
It is showing that the background color should be of value (127, 165, 176)... but the background of the text remains a light gray.

My script is below, I have been testing with the date of "7/11/2024 16:15:02", since the tag value has a date of 7/11/2024. I know I will need to change this to "now()" at the end.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/1/01e735b9f738cf1f7185797f5a8def22a628bd81.png)

When I click the Link for the backgroundColor of the text the above is what I have. Below are the parameters I am using as well.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/b/fbcfa3eb61a668e62ff32d66b5e52fdfa197fd22.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 13, 2024, 3:10pm UTC](https://forum.inductiveautomation.com/t/changing-background-color-of-label-based-on-tag-value-matching-date-in-perspective/93189/2 "2024-07-13T15:10:41Z")

</div>

You cannot use java colors (the `toColor()` expression function) in Perspective. Those are for Vision only.

---

<div class="post-metadata">

**Author:** ![AydHA](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@AydHA](https://forum.inductiveautomation.com/u/AydHA)\
**Post date:** [July 13, 2024, 3:17pm UTC](https://forum.inductiveautomation.com/t/changing-background-color-of-label-based-on-tag-value-matching-date-in-perspective/93189/3 "2024-07-13T15:17:52Z")

</div>

Thank you, removing the toColor() function made the backgroundColor accept the colors.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/8205d0dba7c7395545898fe51392801232278ef2.png)

Appreciate the help!
