<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jaime Aleman</title>
    <description>The latest articles on DEV Community by Jaime Aleman (@jjaimealeman).</description>
    <link>https://dev.to/jjaimealeman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F707788%2Fdac186a4-218e-41a5-9189-ece33b28d2ac.png</url>
      <title>DEV Community: Jaime Aleman</title>
      <link>https://dev.to/jjaimealeman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jjaimealeman"/>
    <language>en</language>
    <item>
      <title>My Theme Switcher with live favicon update!</title>
      <dc:creator>Jaime Aleman</dc:creator>
      <pubDate>Mon, 04 Oct 2021 23:47:07 +0000</pubDate>
      <link>https://dev.to/jjaimealeman/my-theme-switcher-with-live-favicon-update-2pdh</link>
      <guid>https://dev.to/jjaimealeman/my-theme-switcher-with-live-favicon-update-2pdh</guid>
      <description>&lt;h2&gt;
  
  
  My Theme Switcher
&lt;/h2&gt;

&lt;h3&gt;
  
  
  With live updating favicon, also!
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;View live here &lt;a href="https://organizedfellow.github.io/my-theme-switcher/" rel="noopener noreferrer"&gt;https://organizedfellow.github.io/my-theme-switcher/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It seems that now just about every website has a "Theme Switcher" ability.&lt;/p&gt;

&lt;p&gt;Well, here's my version of the same thing 😉&lt;/p&gt;

&lt;p&gt;SVGs were created in &lt;a href="https://designer.gravit.io/" rel="noopener noreferrer"&gt;https://designer.gravit.io/&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Forganizedfellow.github.io%2Fmy-theme-switcher%2Fimages%2Ffavicon.svg" title="favicon.svg" alt="favicon.svg!"&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Forganizedfellow.github.io%2Fmy-theme-switcher%2Fimages%2Fdark.svg" title="dark.svg" alt="dark.svg!"&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Forganizedfellow.github.io%2Fmy-theme-switcher%2Fimages%2Flight.svg" title="light.svg" alt="light.svg!"&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Forganizedfellow.github.io%2Fmy-theme-switcher%2Fimages%2Ficon-moon.svg" title="icon-moon.svg" alt="icon-moon.svg!"&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Forganizedfellow.github.io%2Fmy-theme-switcher%2Fimages%2Ficon-sun.svg" title="icon-sun.svg" alt="icon-sun.svg!"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SVGs have been optimized using &lt;a href="https://jakearchibald.github.io/svgomg/" rel="noopener noreferrer"&gt;https://jakearchibald.github.io/svgomg/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Original source for the theme switcher came from &lt;a href="https://lukelowrey.com/css-variable-theme-switcher/" rel="noopener noreferrer"&gt;Luke Lowrey&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But I came up with the favicon switching by sourcing from Stackoverflow, CSS Tricks, and various other places.&lt;/p&gt;

&lt;p&gt;If you would rather use png to support older browsers, you can use &lt;a href="https://convertio.co/svg-png/" rel="noopener noreferrer"&gt;https://convertio.co/svg-png/&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The one thing I could NOT figure out - &lt;em&gt;how to preload the appropriate favicon based on localStorage. That's why I have favicon.svg set as the default&lt;/em&gt;. If someone could figure that out for me, that would be awesome!&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Here are the icons to make it easier to get started with in your project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;/images/favicon.svg&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" style="isolation:isolate" viewBox="68 10 14 14" width="14pt" height="14pt"&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="75" cy="17" r="7" fill="#A3B7CC"/&amp;gt;&amp;lt;path d="M75 10c-3.863 0-7 3.137-7 7s3.137 7 7 7V10Z" fill-rule="evenodd" fill="#FFEC38"/&amp;gt;&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;p&gt;/images/dark.svg&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" style="isolation:isolate" viewBox="9 8.5 14 14" width="14pt" height="14pt"&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="16" cy="15.5" r="7" fill="#A3B7CC"/&amp;gt;&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;p&gt;/images/light.svg&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" style="isolation:isolate" viewBox="30.686 8.5 14 14" width="14pt" height="14pt"&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="37.686" cy="15.5" r="7" fill="#FFEC38"/&amp;gt;&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;p&gt;/images/icon-moon.svg&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" style="isolation:isolate" viewBox="34 30 22 22" width="22pt" height="22pt"&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="45" cy="41" r="11" fill="#EBEBEB"/&amp;gt;&amp;lt;path d="M43.122 30.164A10.657 10.657 0 0 1 45 30c6.071 0 11 4.929 11 11s-4.929 11-11 11a10.92 10.92 0 0 1-6.752-2.323c.971.32 2.008.49 3.085.49 5.565 0 10.084-4.519 10.084-10.084 0-4.954-3.581-9.078-8.295-9.919Z" fill-rule="evenodd" fill="#A3B7CC"/&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="40.708" cy="44.208" r="1.833" fill="#A3B7CC"/&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="45.749" cy="38.25" r="1.375" fill="#A3B7CC"/&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="39.103" cy="37.104" r="1.146" fill="#A3B7CC"/&amp;gt;&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;p&gt;/images/icon-sun.svg&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" style="isolation:isolate" viewBox="39 39 22 22" width="22pt" height="22pt"&amp;gt;&amp;lt;path d="M46.778 42.222h-4.556v4.556L39 50l3.222 3.222v4.556h4.556L50 61l3.222-3.222h4.556v-4.556L61 50l-3.222-3.222v-4.556h-4.556L50 39l-3.222 3.222Z" fill-rule="evenodd" fill="#FF9B07"/&amp;gt;&amp;lt;circle vector-effect="non-scaling-stroke" cx="50" cy="50" r="6.806" fill="#FFEC38"/&amp;gt;&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;This is my first contribution to the community.&lt;/p&gt;

&lt;p&gt;Let me know if you like it and please tell me how else I could optimize the JavaScript. I am still learning :) &lt;/p&gt;

&lt;p&gt;Enjoy friends! &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
