<?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 Change background color of highlighted feature layer ArcGIS JavaScript in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-background-color-of-highlighted-feature/m-p/1257446#M80229</link>
    <description>&lt;P&gt;I have a feature layer and I am highlighting the feature of the feature layers on click. It is working fine.&lt;/P&gt;&lt;P&gt;Now what I want is, I want to change the background color / fill some color in that highlighted polygon feature.&lt;/P&gt;&lt;P&gt;Here is the code where I am highlighting the feature:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;let&lt;/SPAN&gt; highlight;
&lt;SPAN class=""&gt;let&lt;/SPAN&gt; highlightIds = [];

view.&lt;SPAN class=""&gt;whenLayerView&lt;/SPAN&gt;(districtLayer).&lt;SPAN class=""&gt;then&lt;/SPAN&gt;(&lt;SPAN class=""&gt;function&lt;/SPAN&gt;(&lt;SPAN class=""&gt;layerView&lt;/SPAN&gt;){
    view.&lt;SPAN class=""&gt;on&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"click"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;(&lt;SPAN class=""&gt;event&lt;/SPAN&gt;) =&amp;gt;&lt;/SPAN&gt; {
        &lt;SPAN class=""&gt;const&lt;/SPAN&gt; params = {
            &lt;SPAN class=""&gt;location&lt;/SPAN&gt;: event.&lt;SPAN class=""&gt;mapPoint&lt;/SPAN&gt;
        };
        locator.&lt;SPAN class=""&gt;locationToAddress&lt;/SPAN&gt;(serviceUrl, params).&lt;SPAN class=""&gt;then&lt;/SPAN&gt;(&lt;SPAN class=""&gt;function&lt;/SPAN&gt;(&lt;SPAN class=""&gt;response&lt;/SPAN&gt;) { &lt;SPAN class=""&gt;// Show the address found&lt;/SPAN&gt;
            
            &lt;SPAN class=""&gt;const&lt;/SPAN&gt; district = response.&lt;SPAN class=""&gt;attributes&lt;/SPAN&gt;.&lt;SPAN class=""&gt;Subregion&lt;/SPAN&gt;;

            &lt;SPAN class=""&gt;// remove all highlights first&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt;(highlight) {
                highlight.&lt;SPAN class=""&gt;remove&lt;/SPAN&gt;();
            }

            &lt;SPAN class=""&gt;// check if district is already highlighted&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;let&lt;/SPAN&gt; district_id = districtIds.&lt;SPAN class=""&gt;indexOf&lt;/SPAN&gt;(district) + &lt;SPAN class=""&gt;1&lt;/SPAN&gt;;
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt;(highlightIds.&lt;SPAN class=""&gt;includes&lt;/SPAN&gt;(district_id)){
                highlightIds.&lt;SPAN class=""&gt;splice&lt;/SPAN&gt;(highlightIds.&lt;SPAN class=""&gt;indexOf&lt;/SPAN&gt;(district_id), &lt;SPAN class=""&gt;1&lt;/SPAN&gt;);
            }&lt;SPAN class=""&gt;else&lt;/SPAN&gt;{
                highlightIds.&lt;SPAN class=""&gt;push&lt;/SPAN&gt;(district_id);
            }

            &lt;SPAN class=""&gt;// hightlight only the selected districts&lt;/SPAN&gt;
            highlight = layerView.&lt;SPAN class=""&gt;highlight&lt;/SPAN&gt;(highlightIds);

            &lt;SPAN class=""&gt;// code here to fill background color&lt;/SPAN&gt;

        }, &lt;SPAN class=""&gt;function&lt;/SPAN&gt;(&lt;SPAN class=""&gt;err&lt;/SPAN&gt;) { &lt;SPAN class=""&gt;// Show no address found&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"No address found."&lt;/SPAN&gt;, evt.&lt;SPAN class=""&gt;mapPoint&lt;/SPAN&gt;);
        });
    });
});&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Feb 2023 08:07:16 GMT</pubDate>
    <dc:creator>aggarwalarpit93</dc:creator>
    <dc:date>2023-02-13T08:07:16Z</dc:date>
    <item>
      <title>Change background color of highlighted feature layer ArcGIS JavaScript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-background-color-of-highlighted-feature/m-p/1257446#M80229</link>
      <description>&lt;P&gt;I have a feature layer and I am highlighting the feature of the feature layers on click. It is working fine.&lt;/P&gt;&lt;P&gt;Now what I want is, I want to change the background color / fill some color in that highlighted polygon feature.&lt;/P&gt;&lt;P&gt;Here is the code where I am highlighting the feature:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;let&lt;/SPAN&gt; highlight;
&lt;SPAN class=""&gt;let&lt;/SPAN&gt; highlightIds = [];

view.&lt;SPAN class=""&gt;whenLayerView&lt;/SPAN&gt;(districtLayer).&lt;SPAN class=""&gt;then&lt;/SPAN&gt;(&lt;SPAN class=""&gt;function&lt;/SPAN&gt;(&lt;SPAN class=""&gt;layerView&lt;/SPAN&gt;){
    view.&lt;SPAN class=""&gt;on&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"click"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;(&lt;SPAN class=""&gt;event&lt;/SPAN&gt;) =&amp;gt;&lt;/SPAN&gt; {
        &lt;SPAN class=""&gt;const&lt;/SPAN&gt; params = {
            &lt;SPAN class=""&gt;location&lt;/SPAN&gt;: event.&lt;SPAN class=""&gt;mapPoint&lt;/SPAN&gt;
        };
        locator.&lt;SPAN class=""&gt;locationToAddress&lt;/SPAN&gt;(serviceUrl, params).&lt;SPAN class=""&gt;then&lt;/SPAN&gt;(&lt;SPAN class=""&gt;function&lt;/SPAN&gt;(&lt;SPAN class=""&gt;response&lt;/SPAN&gt;) { &lt;SPAN class=""&gt;// Show the address found&lt;/SPAN&gt;
            
            &lt;SPAN class=""&gt;const&lt;/SPAN&gt; district = response.&lt;SPAN class=""&gt;attributes&lt;/SPAN&gt;.&lt;SPAN class=""&gt;Subregion&lt;/SPAN&gt;;

            &lt;SPAN class=""&gt;// remove all highlights first&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt;(highlight) {
                highlight.&lt;SPAN class=""&gt;remove&lt;/SPAN&gt;();
            }

            &lt;SPAN class=""&gt;// check if district is already highlighted&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;let&lt;/SPAN&gt; district_id = districtIds.&lt;SPAN class=""&gt;indexOf&lt;/SPAN&gt;(district) + &lt;SPAN class=""&gt;1&lt;/SPAN&gt;;
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt;(highlightIds.&lt;SPAN class=""&gt;includes&lt;/SPAN&gt;(district_id)){
                highlightIds.&lt;SPAN class=""&gt;splice&lt;/SPAN&gt;(highlightIds.&lt;SPAN class=""&gt;indexOf&lt;/SPAN&gt;(district_id), &lt;SPAN class=""&gt;1&lt;/SPAN&gt;);
            }&lt;SPAN class=""&gt;else&lt;/SPAN&gt;{
                highlightIds.&lt;SPAN class=""&gt;push&lt;/SPAN&gt;(district_id);
            }

            &lt;SPAN class=""&gt;// hightlight only the selected districts&lt;/SPAN&gt;
            highlight = layerView.&lt;SPAN class=""&gt;highlight&lt;/SPAN&gt;(highlightIds);

            &lt;SPAN class=""&gt;// code here to fill background color&lt;/SPAN&gt;

        }, &lt;SPAN class=""&gt;function&lt;/SPAN&gt;(&lt;SPAN class=""&gt;err&lt;/SPAN&gt;) { &lt;SPAN class=""&gt;// Show no address found&lt;/SPAN&gt;
            &lt;SPAN class=""&gt;console&lt;/SPAN&gt;.&lt;SPAN class=""&gt;log&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"No address found."&lt;/SPAN&gt;, evt.&lt;SPAN class=""&gt;mapPoint&lt;/SPAN&gt;);
        });
    });
});&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Feb 2023 08:07:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-background-color-of-highlighted-feature/m-p/1257446#M80229</guid>
      <dc:creator>aggarwalarpit93</dc:creator>
      <dc:date>2023-02-13T08:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change background color of highlighted feature layer ArcGIS JavaScript</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-background-color-of-highlighted-feature/m-p/1257979#M80245</link>
      <description>&lt;P&gt;If you just want to change the standard highlight color you can access&amp;nbsp; `&lt;SPAN&gt;&lt;STRONG&gt;highlightOptions&lt;/STRONG&gt;` of the view.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.highlightOptions = {}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#highlightOptions" target="_blank" rel="noopener"&gt;MapView | API Reference | ArcGIS Maps SDK for JavaScript 4.25 | ArcGIS Developers&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:14:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/change-background-color-of-highlighted-feature/m-p/1257979#M80245</guid>
      <dc:creator>Christer</dc:creator>
      <dc:date>2023-02-15T15:14:46Z</dc:date>
    </item>
  </channel>
</rss>

