Select to view content in your preferred language

Change individual text colors in Arcade Element

1961
5
Jump to solution
08-29-2023 01:20 PM
Ed_
by MVP Regular Contributor
MVP Regular Contributor

Based on the code below how can I change the colors of certain words individually.

Purpose: To learn how to change colors in Arcade element.

// Create a variable that the FeatureSet of intersecting feature attributes  
var building = FeatureSetByName($map, "BuildingFootprints_Clip")

var intersectLayer = Intersects(building, $feature)  

// This variable will be repeated multiple times in the code
var popup = '<h2>Building</h2>';

for (var f in intersectLayer){ 
   popup += `<b>Area:</b> ${f.AREAFT} <br><br>

  
  <b>Length:</b> ${f.LENFT} <br><br>
  
  
  <b>ID:</b> ${f.ID} <br><br>
`
}  

 

Desired output:

Area: Value

Length: Value

ID: Value

Question | Analyze | Visualize
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

This will make Area red

for (var f in intersectLayer){ 
   popup += `<b><font color = "#ff0000">Area</font>:</b> ${f.AREAFT} <br><br>
  <b>Length:</b> ${f.LENFT} <br><br>
  <b>ID:</b> ${f.ID} <br><br>`
}  

View solution in original post

5 Replies
ArmstKP
Frequent Contributor
Ed_
by MVP Regular Contributor
MVP Regular Contributor

Thank you for the quick response and for providing the link 🙂

Question | Analyze | Visualize
KenBuja
MVP Esteemed Contributor

This will make Area red

for (var f in intersectLayer){ 
   popup += `<b><font color = "#ff0000">Area</font>:</b> ${f.AREAFT} <br><br>
  <b>Length:</b> ${f.LENFT} <br><br>
  <b>ID:</b> ${f.ID} <br><br>`
}  
Ed_
by MVP Regular Contributor
MVP Regular Contributor

Thank you Ken 🙂 so can <font color = "HEX code"> also applied on "Length", "ID" and the heading "<h2>Buidling<h2>? 

Question | Analyze | Visualize
0 Kudos
KenBuja
MVP Esteemed Contributor

Yes, you'll have to add <font color = "HEX code">text</font> to each item you want with a separate color