Select to view content in your preferred language

Changing the color of JSON pulldata() text

1116
2
Jump to solution
08-29-2022 12:39 PM
MattEdrich
Frequent Contributor

Hello everyone,

I'm not great with JSON scripts and was grateful to find answers here for automating certain answers to survey forms using JSON scripts. The scripts in my survey (populating technician name based on ArcGIS Online username) are working just fine, but I want to change the color of the returned text (the technician's name). Branding is important to my company and our color palette has many shades of blue, and unfortunately the color of the tech's name at the moment is not very readable against the input background color.

I want to use a hex code to set a color for the returned text, but nothing I have tried so far seems to do it. I have tried inserting a font color parameter into the 

pulldata("@json", ${member_lookup}, "firstName") + " " + pulldata("@json", ${member_lookup}, "lastName")


field in calculation column for the survey item in question, as well as within the body::esri:style column, in many different iterations, to no avail. I'm sure this is possible, but I can't seem to figure out how.

Help is appreciated, thank you!

0 Kudos
1 Solution

Accepted Solutions
LaurenceTait
Frequent Contributor

You can only use html to set the font colour for labels and hints.

You can readily convert the result of a calculation to a hint or a label and set the colour on that. I've attached an example below (using a csv, rather than a json, but the working is identical).

LaurenceTait_0-1661819565531.png

LaurenceTait_1-1661819598048.png

 

I'm not sure what exactly you want to achieve, so I'm not sure if that works for you..

View solution in original post

0 Kudos
2 Replies
LaurenceTait
Frequent Contributor

You can only use html to set the font colour for labels and hints.

You can readily convert the result of a calculation to a hint or a label and set the colour on that. I've attached an example below (using a csv, rather than a json, but the working is identical).

LaurenceTait_0-1661819565531.png

LaurenceTait_1-1661819598048.png

 

I'm not sure what exactly you want to achieve, so I'm not sure if that works for you..

0 Kudos
MattEdrich
Frequent Contributor

Thanks Laurence! Your suggestion nailed it, actually - I just wasn't thinking outside of the box far enough. I appreciate it!

0 Kudos