<?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: Toggling Light/Dark theme programmatically API 4.x in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1124925#M75560</link>
    <description>&lt;P&gt;I don't know how you're updating it, but you can just update the href of the link tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let theme = "dark";
btn.addEventListener("click", () =&amp;gt; {
    if (theme === "light") {
      sheet.href = "https://js.arcgis.com/4.22/esri/themes/dark/main.css";
      theme = "dark";
    } else if (theme === "dark") {
      sheet.href = "https://js.arcgis.com/4.22/esri/themes/light/main.css";
      theme = "light";
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/qBPaPpR?editors=1000" target="_blank" rel="noopener"&gt;https://codepen.io/odoe/pen/qBPaPpR?editors=1000&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Dec 2021 16:56:48 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2021-12-10T16:56:48Z</dc:date>
    <item>
      <title>Toggling Light/Dark theme programmatically API 4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1124885#M75555</link>
      <description>&lt;P&gt;The API provides two different css files for light and dark theme. I am trying to figure out a better way of switching theme on toggle button click. I've tried unloading the light css file then load the dark css file and I am not impressed with this approach. Does anybody out there ever tried this?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 15:50:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1124885#M75555</guid>
      <dc:creator>RichardMoussopo</dc:creator>
      <dc:date>2021-12-10T15:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling Light/Dark theme programmatically API 4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1124925#M75560</link>
      <description>&lt;P&gt;I don't know how you're updating it, but you can just update the href of the link tag.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let theme = "dark";
btn.addEventListener("click", () =&amp;gt; {
    if (theme === "light") {
      sheet.href = "https://js.arcgis.com/4.22/esri/themes/dark/main.css";
      theme = "dark";
    } else if (theme === "dark") {
      sheet.href = "https://js.arcgis.com/4.22/esri/themes/light/main.css";
      theme = "light";
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/qBPaPpR?editors=1000" target="_blank" rel="noopener"&gt;https://codepen.io/odoe/pen/qBPaPpR?editors=1000&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 16:56:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1124925#M75560</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-10T16:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling Light/Dark theme programmatically API 4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1125451#M75580</link>
      <description>&lt;P&gt;Thank you Rene,&amp;nbsp;I am using React but this did the trick. I really appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 16:25:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1125451#M75580</guid>
      <dc:creator>RichardMoussopo</dc:creator>
      <dc:date>2021-12-13T16:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling Light/Dark theme programmatically API 4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1134423#M75945</link>
      <description>&lt;P&gt;René,&lt;/P&gt;&lt;P&gt;How do you listen for changes to the theme? I have developed a widget and would like to listen for the theme changes for the internal CSS.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;René T.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 20:12:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1134423#M75945</guid>
      <dc:creator>René_Ténière</dc:creator>
      <dc:date>2022-01-17T20:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Toggling Light/Dark theme programmatically API 4.x</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1347039#M82722</link>
      <description>&lt;P&gt;This seems to no longer function for the popup? It seems "something" happened around version 4.25..? It is possible to make the popup light if you import light stylesheet, and dark if you import dark. But if you switch in runtime, nothing happens in the popup.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 07:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggling-light-dark-theme-programmatically-api-4-x/m-p/1347039#M82722</guid>
      <dc:creator>LindaCecilieKjeldsen</dc:creator>
      <dc:date>2023-11-08T07:53:06Z</dc:date>
    </item>
  </channel>
</rss>

