<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Change text color based on value/label using Arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344109#M55523</link>
    <description>&lt;P&gt;There are a couple of ways to do that. The original way is outlined in this &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/bring-colors-from-your-map-into-your-pop-up-using-arcade/" target="_self"&gt;blog&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The more modern way is to use the &lt;A href="https://doc.arcgis.com/en/arcgis-online/create-maps/configure-pop-ups-mv.htm#ESRI_SECTION1_F5CB09E0313A4DA1BD10F18D875FFC3F" target="_self"&gt;Arcade element&lt;/A&gt;, which allows you to use HTML tags directly. I've simpified your code, using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_self"&gt;When&lt;/A&gt; function (replacing all the ifs) and &lt;A href="https://developers.arcgis.com/arcade/guide/template-literals/" target="_self"&gt;template literals&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var r1 = $feature.["Risk_Level"];
var output = When(r1 == 0, "Lowest",
                  r1 &amp;lt; 2, `&amp;lt;p style=color:rgb(142,211,231)&amp;gt;Very low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 3, `&amp;lt;p style=color:rgb(89,184,98)&amp;gt;Low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 4, `&amp;lt;p style=color:rgb(255,255,63)&amp;gt;Moderate&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 5, `&amp;lt;p style=color:rgb(254,166,32)&amp;gt;High&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 6, `&amp;lt;p style=color:rgb(252,56,57)&amp;gt;Very high&amp;lt;/p&amp;gt;`,
                  `&amp;lt;p style=color:rgb(205,0,103)&amp;gt;Highest&amp;lt;/p&amp;gt;`)

return { 
	type : 'text', 
	text : output //this property supports html tags 
}&lt;/LI-CODE&gt;&lt;P&gt;Note: when posting code, using an image makes it more difficult for us to copy and paste to give an answer. Instead, use the &lt;A href="https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552" target="_self"&gt;Insert/Edit code sample&lt;/A&gt; icon&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2023 19:44:05 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2023-10-31T19:44:05Z</dc:date>
    <item>
      <title>Change text color based on value/label using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344075#M55519</link>
      <description>&lt;P&gt;In my pop-up, I'd like to have the text correspond with the map symbology color. Any suggestions on how to do so? I tried the following below with no success:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_0-1698778268319.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84606i026AAB3CCD9E7D66/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dwold_0-1698778268319.png" alt="dwold_0-1698778268319.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_1-1698778304052.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84607i8A667C2C10D29B30/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dwold_1-1698778304052.png" alt="dwold_1-1698778304052.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_2-1698778317863.png" style="width: 175px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84608i2CCAB371E41F6DC8/image-dimensions/175x255?v=v2" width="175" height="255" role="button" title="dwold_2-1698778317863.png" alt="dwold_2-1698778317863.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 18:53:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344075#M55519</guid>
      <dc:creator>dwold</dc:creator>
      <dc:date>2023-10-31T18:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change text color based on value/label using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344109#M55523</link>
      <description>&lt;P&gt;There are a couple of ways to do that. The original way is outlined in this &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/bring-colors-from-your-map-into-your-pop-up-using-arcade/" target="_self"&gt;blog&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The more modern way is to use the &lt;A href="https://doc.arcgis.com/en/arcgis-online/create-maps/configure-pop-ups-mv.htm#ESRI_SECTION1_F5CB09E0313A4DA1BD10F18D875FFC3F" target="_self"&gt;Arcade element&lt;/A&gt;, which allows you to use HTML tags directly. I've simpified your code, using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_self"&gt;When&lt;/A&gt; function (replacing all the ifs) and &lt;A href="https://developers.arcgis.com/arcade/guide/template-literals/" target="_self"&gt;template literals&lt;/A&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var r1 = $feature.["Risk_Level"];
var output = When(r1 == 0, "Lowest",
                  r1 &amp;lt; 2, `&amp;lt;p style=color:rgb(142,211,231)&amp;gt;Very low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 3, `&amp;lt;p style=color:rgb(89,184,98)&amp;gt;Low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 4, `&amp;lt;p style=color:rgb(255,255,63)&amp;gt;Moderate&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 5, `&amp;lt;p style=color:rgb(254,166,32)&amp;gt;High&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 6, `&amp;lt;p style=color:rgb(252,56,57)&amp;gt;Very high&amp;lt;/p&amp;gt;`,
                  `&amp;lt;p style=color:rgb(205,0,103)&amp;gt;Highest&amp;lt;/p&amp;gt;`)

return { 
	type : 'text', 
	text : output //this property supports html tags 
}&lt;/LI-CODE&gt;&lt;P&gt;Note: when posting code, using an image makes it more difficult for us to copy and paste to give an answer. Instead, use the &lt;A href="https://community.esri.com/t5/community-help-documents/how-to-insert-code-in-your-post/ta-p/914552" target="_self"&gt;Insert/Edit code sample&lt;/A&gt; icon&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 19:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344109#M55523</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-10-31T19:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change text color based on value/label using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344125#M55524</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;Thank you!!!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 20:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344125#M55524</guid>
      <dc:creator>dwold</dc:creator>
      <dc:date>2023-10-31T20:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Change text color based on value/label using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344396#M55545</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;do you see anything I am missing in the code?&lt;/P&gt;&lt;P&gt;this my pop-up:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_0-1698848805231.png" style="width: 259px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84679i51CCD69B4845E946/image-dimensions/259x136?v=v2" width="259" height="136" role="button" title="dwold_0-1698848805231.png" alt="dwold_0-1698848805231.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var r1 = $feature["Risk_Level"];
var output = When(r1 == 0, "Lowest",
                  r1 &amp;lt; 2, `&amp;lt;p style=color:rgb(142,211,231)&amp;gt;Very low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 3, `&amp;lt;p style=color:rgb(89,184,98)&amp;gt;Low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 4, `&amp;lt;p style=color:rgb(255,255,63)&amp;gt;Moderate&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 5, `&amp;lt;p style=color:rgb(254,166,32)&amp;gt;High&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 6, `&amp;lt;p style=color:rgb(252,56,57)&amp;gt;Very high&amp;lt;/p&amp;gt;`,
                  `&amp;lt;p style=color:rgb(205,0,103)&amp;gt;Highest&amp;lt;/p&amp;gt;`)

return { 
	type : 'text', 
	text : output //this property supports html tags 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried this with no luck:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var r1 = $feature["Risk_Level"];
var output = When(r1 == 0, "Lowest",
                  r1 &amp;lt; 1, `&amp;lt;p style=color:rgb(142,211,231)&amp;gt;Very low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 2, `&amp;lt;p style=color:rgb(89,184,98)&amp;gt;Low&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 3, `&amp;lt;p style=color:rgb(255,255,63)&amp;gt;Moderate&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 4, `&amp;lt;p style=color:rgb(254,166,32)&amp;gt;High&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 5, `&amp;lt;p style=color:rgb(252,56,57)&amp;gt;Very high&amp;lt;/p&amp;gt;`,
                  r1 &amp;lt; 6, `&amp;lt;p style=color:rgb(205,0,103)&amp;gt;Highest&amp;lt;/p&amp;gt;`)

return { 
	type : 'text', 
	text : output //this property supports html tags 
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_1-1698849372165.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84682iB6490D36677C3F87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dwold_1-1698849372165.png" alt="dwold_1-1698849372165.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 14:38:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344396#M55545</guid>
      <dc:creator>dwold</dc:creator>
      <dc:date>2023-11-01T14:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change text color based on value/label using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344408#M55547</link>
      <description>&lt;P&gt;You have to add this code to a Arcade element&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="popup.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84684iA14B532B6E6C2912/image-size/medium?v=v2&amp;amp;px=400" role="button" title="popup.png" alt="popup.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 14:39:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1344408#M55547</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-11-01T14:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change text color based on value/label using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1373252#M57013</link>
      <description>&lt;P&gt;I'm trying to do something similar, except I want the HydrantID field to be the label where it turns red if Public and yellow if Private.&amp;nbsp; The Public or Private information is in the Owner field.&amp;nbsp; Is that something that can be done with modifications to this code?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 23:30:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1373252#M57013</guid>
      <dc:creator>JasminePrater</dc:creator>
      <dc:date>2024-01-22T23:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Change text color based on value/label using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1394235#M58028</link>
      <description>&lt;P&gt;Thank you Ken, this is very helpful.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 17:16:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/change-text-color-based-on-value-label-using/m-p/1394235#M58028</guid>
      <dc:creator>ctalleygreenville</dc:creator>
      <dc:date>2024-03-11T17:16:16Z</dc:date>
    </item>
  </channel>
</rss>

