# Using Option Sets to change color based on User's name

**URL:** <https://forum.bubble.io/t/using-option-sets-to-change-color-based-on-users-name/214475>\
**Category:** Need help\
**Created:** [July 7, 2022, 4:09pm UTC](https://forum.bubble.io/t/using-option-sets-to-change-color-based-on-users-name/214475 "2022-07-07T16:09:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![doug4](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@doug4](https://forum.bubble.io/u/doug4)\
**Post date:** [July 7, 2022, 4:09pm UTC](https://forum.bubble.io/t/using-option-sets-to-change-color-based-on-users-name/214475/1 "2022-07-07T16:09:20Z")

</div>

I would like to use an option set that sets the color of a background based on the current user’s name.

For example, if we have a user named Adam, I would like the background color to be set dynamically using the first letter of his name ‘A’. If a user was named Bob, then it would set the background color based on the first letter ‘B’.

I have an option set that has 26 letters for the display (A through Z), and an attribute for Color for the HEX code. I am just not sure how to setup the dynamic color using an expression. I can extract the current user’s first name:trimmed 1:uppercase to get the letter, but I don’t know how to apply the correct color from the option set.

Can anyone point me in the right direction?

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [July 7, 2022, 4:21pm UTC](https://forum.bubble.io/t/using-option-sets-to-change-color-based-on-users-name/214475/2 "2022-07-07T16:21:21Z")

</div>

Hi there, @doug4… I just made a quick example, and this expression appears to do what you described.

 ![color](https://us1.discourse-cdn.com/bubble/original/3X/e/4/e4bbfcaea7807e43d15a9bd3561d2fc58825ffe2.png)

Hope this helps.

Best…  
Mike

---

<div class="post-metadata">

**Author:** ![doug4](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@doug4](https://forum.bubble.io/u/doug4)\
**Post date:** [July 7, 2022, 8:38pm UTC](https://forum.bubble.io/t/using-option-sets-to-change-color-based-on-users-name/214475/3 "2022-07-07T20:38:59Z")

</div>

Mike,

Thank you very much, this worked perfectly. I’m not sure how long it would have taken me to figure this out, but let’s just say I wasn’t too close.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [September 15, 2022, 4:10pm UTC](https://forum.bubble.io/t/using-option-sets-to-change-color-based-on-users-name/214475/4 "2022-09-15T16:10:16Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
