Is there a way to adjust the color of an arcade expression based on field vlaue?

457
2
Jump to solution
06-22-2020 05:02 AM
LukeAllen2
New Contributor III

Good morning!

I have a question that somebody hopefully can provide some pointers. In my AGOL map I have a feature that contains a  field that has 4 different land use values in it, eg, Agricultural, Industrial, Commercial etc.

I was thinking of setting up a when statement so that for when each of these values is true it would assign them a particular RGB color - this would avoid having to create individual expressions in the pop-up window for each value and assigning it a color through the pop-up config. I'm pretty sure I know how to make the when statement, what is throwing me off is how to the color part, I'm assuming I would have to provide some RGB values into.

Is this possible to do?

0 Kudos
1 Solution

Accepted Solutions
Egge-JanPollé1
MVP Regular Contributor

Hi Luke Allen,

Did you have a look at the example in this blog?

Bring Colors From Your Map Into Your Pop-up Using Arcade 

I am not sure whether it is possible to use RGB values as such, but it would be better to use hexadecimal color values instead. You will find plenty of RGB to hex convertors on the web, so if you pick blue (0,0,255) it should not be difficult to find the hexadecimal value #0000ff. And the same is true for the other (255*255*255-1=) ‭16,581,374‬ possible values.

HTH,

Egge-Jan

View solution in original post

0 Kudos
2 Replies
Egge-JanPollé1
MVP Regular Contributor

Hi Luke Allen,

Did you have a look at the example in this blog?

Bring Colors From Your Map Into Your Pop-up Using Arcade 

I am not sure whether it is possible to use RGB values as such, but it would be better to use hexadecimal color values instead. You will find plenty of RGB to hex convertors on the web, so if you pick blue (0,0,255) it should not be difficult to find the hexadecimal value #0000ff. And the same is true for the other (255*255*255-1=) ‭16,581,374‬ possible values.

HTH,

Egge-Jan

0 Kudos
LukeAllen2
New Contributor III

Hi Egge,

Thanks for the prompt response - funny enough I actually came across as started working through Lisa's blog example with my own data, I'm hopefully this will be what I need - thanks!

0 Kudos