Hello! Looking for help writing Arcade script to define a specific selection color for a variable in a Dashboard List. The script I have so far is written out below. When I run the script the selection color does not show up in my Dashboard List. Please help, and thank you.
var green = When($datapoint.project_status == "Active / Awarded", '#55ff00','')
return {
textColor: '',
backgroundColor: '',
separatorColor:'',
selectionColor: green,
selectionTextColor: '',
// attributes: {
// attribute1: '',
// attribute2: ''
// }
}
Solved! Go to Solution.
I don't see anything wrong with the arcade expression. Are you sure your field name and/or value is correct? One thing I like to do if I'm having issues returning colors, is to return it as an attribute and add that to the list so that I can see exactly what value is being returned. This helps me narrow down where the issue is.
Also note, that the selection color doesn't appear until you have set up an action in your list. Without an action setup, clicking on a list item doesn't select anything and therefore doesn't bring up the selection color.
You would need to return the color hex value as an attribute and then plug that directly into your HTML of the list.
I don't see anything wrong with the arcade expression. Are you sure your field name and/or value is correct? One thing I like to do if I'm having issues returning colors, is to return it as an attribute and add that to the list so that I can see exactly what value is being returned. This helps me narrow down where the issue is.
Also note, that the selection color doesn't appear until you have set up an action in your list. Without an action setup, clicking on a list item doesn't select anything and therefore doesn't bring up the selection color.
Jen, Thank you for the help. A Follow up question for you. How would I change the code to select/highlight/change text color of a specific line of text on my Dashboard List. The script I am running now (see script below) highlights the entire box on my list and changes all of the text color too (See image below).
var colorfas = When (
$datapoint.forecast_actual_scheduled == "Forecast (F)", '#bee8ff',
$datapoint.forecast_actual_scheduled == "Actual (A)", '#d6d6d6',
$datapoint.forecast_actual_scheduled == "Scheduled (S)", '#ffffff', 'n/a')
var colorprojectstatus = When (
$datapoint.project_status == "Active / Awarded", '#55ff00',
$datapoint.project_status == "Cancelled", '#ff0000',
$datapoint.project_status == "Complete", '#ff00c5',
$datapoint.project_status == "In Progress", '#0070ff',
$datapoint.project_status == "On Hold", '#ffff00', 'n/a')
return {
textColor: colorfas,
backgroundColor: colorprojectstatus,
separatorColor: '',
selectionColor: '',
selectionTextColor: '',
// attributes: {
// attribute1: '',
// attribute2: ''
// }
}
You would need to return the color hex value as an attribute and then plug that directly into your HTML of the list.