0

I have varying colors specified in a field and would want to apply those to my labels stored in another field. I'm currently using the attribute driven symbology specifying the colors of the geometries (polygons) this way but I need the labels in the same colors. I know this is probably possible in QGIS but this time I need to do it in ArcGIS Pro. Colors are stored in either HEX, CMYK or RGB.

Tried some variations of the proposed solutions here: Coloring labels in color of features automatically in ArcGIS but with no luck so far. I was hoping for something like this to work: <CLR [COLOR_FIELD]> [LABEL_TEXT_FIELD] .

Is it possible?

1 Answer 1

3

Here's one way to do it. Say you have the field "colors" with values such as "255,0,0". This code will use that to create colors using that field

var red = 0;
var green = 0;
var blue = 0;
if (!IsEmpty($feature.Color)) {
  var colors = Split($feature.Color,",");
  if (Count(colors) == 3){
    red = colors[0];
    green = colors[1];
    blue = colors[2]; 
  }
}
return `<CLR red = "${red}" green = "${green}" blue = "${blue}">${$feature.HABITAT}</CLR>`

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.