# Is it possible color a label by value

**URL:** <https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811>\
**Category:** Ask for Help\
**Created:** [January 28, 2022, 11:26am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811 "2022-01-28T11:26:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krisztian\_Gyuris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krisztian_gyuris/32/36302_2.png) [@Krisztian\_Gyuris](https://community.glideapps.com/u/Krisztian_Gyuris)\
**Post date:** [January 28, 2022, 11:26am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/1 "2022-01-28T11:26:27Z")

</div>

Is it possible to somehow color something you show on screen by its value? For example:

If a number is above zero then it is colored green and if below zero then it is red.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 28, 2022, 11:28am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/2 "2022-01-28T11:28:36Z")

</div>

Yes, it’s possible.  
But depending on what the “something” is, you may need to use some CSS.

Just to clarify what I mean - I mean it depends which component you are using to display the numbers.  
If you are using a single rich text component, for example, then it’s quite straight forward.  
But if you had a whole series of numbers that you want to present as an inline list, then it gets a little more complicated.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 28, 2022, 11:30pm UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/3 "2022-01-28T23:30:33Z")

</div>

Do you have a visual presentation of how you want it to be displayed?

---

<div class="post-metadata">

**Author:** ![Krisztian\_Gyuris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krisztian_gyuris/32/36302_2.png) [@Krisztian\_Gyuris](https://community.glideapps.com/u/Krisztian_Gyuris)\
**Post date:** [January 31, 2022, 11:19am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/4 "2022-01-31T11:19:32Z")

</div>

This is what I want to achieve.

 ![Screenshot 2022-01-31 at 11.22.30](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/0/c09e61db91687614e6ef33bde8b664d2795d8ea6.png)

I would like a single value to be green if the value is greater than 0 and read if it is lower than 0. I do not need the table or displaying multiple values in a row/table

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 31, 2022, 11:29am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/5 "2022-01-31T11:29:16Z")

</div>

So just a single value, that would be displayed in a rich text component?

If so, you could do something like this:

- Create an if-then-else column, that references the number column  
– If Number is less than 0, then red  
– If Number is greater than 0, then green  
– Else black
- Now create a template column, using the following: `<span style="color: {colour};">{number}`  
– Replace `{colour}` with the if-then-else column  
– Replace `{number}` with the original Number column
- Then display the template column in a rich text component.

---

<div class="post-metadata">

**Author:** ![Krisztian\_Gyuris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krisztian_gyuris/32/36302_2.png) [@Krisztian\_Gyuris](https://community.glideapps.com/u/Krisztian_Gyuris)\
**Post date:** [February 1, 2022, 8:34am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/6 "2022-02-01T08:34:03Z")

</div>

Great trick. Thanks for replying and sharing!

---

<div class="post-metadata">

**Author:** ![Krisztian\_Gyuris](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krisztian_gyuris/32/36302_2.png) [@Krisztian\_Gyuris](https://community.glideapps.com/u/Krisztian_Gyuris)\
**Post date:** [February 1, 2022, 8:35am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/7 "2022-02-01T08:35:23Z")

</div>

One last question. Would it be possible to achieve the layout like on the screenshot somehow without the colors with this technique? Like adding divs or other HTML tags?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 1, 2022, 8:39am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/8 "2022-02-01T08:39:25Z")

</div>

Yes, it’s possible. And it’s really just an extension of what I have already shown you.

It’s just a matter of defining the table structure within the template, and then using replacements to insert the appropriate values.

This [tutorial](https://community.glideapps.com/t/how-to-css-table-with-dynamic-filtering-and-sorting/35784) that I created a while back walks through the process of creating a HTML/CSS table.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [February 2, 2022, 8:40am UTC](https://community.glideapps.com/t/is-it-possible-color-a-label-by-value/37811/9 "2022-02-02T08:40:10Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
