# Dynamic label color based on response

**URL:** <https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982>\
**Category:** Support\
**Created:** [June 16, 2021, 4:06pm UTC](https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982 "2021-06-16T16:06:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinia\_Marciano](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/vinia_marciano/32/10972_2.png) [@Vinia\_Marciano](https://forum.getodk.org/u/Vinia_Marciano)\
**Post date:** [June 16, 2021, 4:06pm UTC](https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982/1 "2021-06-16T16:06:32Z")

</div>

Is there a way to dynamically change the color of the label based on the value of the response. We have a survey with select questions with 3 options Yes, No, No response, codes 1,2,3 respectively. Is there a way to change the color of the label of the questions based on the responses, say, if response is Yes(1), the color of the question changes to green, if No (2), the color changes to red, and gray if value 3.

Both in collect and enketo webform. Btw, we are using ODK Central.

Thank you.

Cheers,  
Vinia

---

<div class="post-metadata">

**Author:** ![danbjoseph](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/danbjoseph/32/21901_2.png) [@danbjoseph](https://forum.getodk.org/u/danbjoseph)\
**Post date:** [June 21, 2021, 1:09pm UTC](https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982/2 "2021-06-21T13:09:50Z")

</div>

There is not a way to change the styling of an option in the list after selecting that option. You can adjust the [font and colors](https://docs.getodk.org/form-styling/#fonts-and-colors) but it is a static adjustment.

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [June 23, 2021, 3:45am UTC](https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982/3 "2021-06-23T03:45:40Z")

</div>

I agree with @danbjoseph that options can't be styled in a list. Is it the color of the _label_ that you want to change? The label of a question can't be updated by its own value. However, you can achieve roughly what you want by conditionally setting the style of another note in the same field list. It's a bit clunky but see what you think of [this example](https://docs.google.com/spreadsheets/d/1ER6ZFUZcVIY-Tsb8F9pvq04i72K76G_xx9HWKW0yT3Q/edit#gid=0) and perhaps it will give you some ideas.

---

<div class="post-metadata">

**Author:** ![Vinia\_Marciano](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/vinia_marciano/32/10972_2.png) [@Vinia\_Marciano](https://forum.getodk.org/u/Vinia_Marciano)\
**Post date:** [August 12, 2021, 12:30pm UTC](https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982/4 "2021-08-12T12:30:29Z")

</div>

Thanks, Hélène. This works in Collect. Doesn't work in Enketo though.  
(@martijnr Hi Martijn 🙂, I hope there's a way to make this work in Enketo. Regards.)

Cheers,  
Vinia

---

<div class="post-metadata">

**Author:** ![martijnr](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/martijnr/32/1614_2.png) [@martijnr](https://forum.getodk.org/u/martijnr)\
**Post date:** [August 13, 2021, 7:25pm UTC](https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982/5 "2021-08-13T19:25:21Z")

</div>

> [@Vinia\_Marciano](#):
>
> I hope there's a way to make this work in Enketo

Would be a big project, since Enketo currently evaluates all the formatting before the form is served to the browser, so there is no client-side processing. Enketo would need to change that approach (and not do both).

---

<div class="post-metadata">

**Author:** ![Vinia\_Marciano](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/vinia_marciano/32/10972_2.png) [@Vinia\_Marciano](https://forum.getodk.org/u/Vinia_Marciano)\
**Post date:** [August 14, 2021, 2:18am UTC](https://forum.getodk.org/t/dynamic-label-color-based-on-response/33982/6 "2021-08-14T02:18:45Z")

</div>

Got that. Thanks, Martijn!
