<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Garrett W. on Medium]]></title>
        <description><![CDATA[Stories by Garrett W. on Medium]]></description>
        <link>https://medium.com/@updatesettings?source=rss-2090f88dbb94------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_K8OySQqQKOLouu_HkA-wQ.jpeg</url>
            <title>Stories by Garrett W. on Medium</title>
            <link>https://medium.com/@updatesettings?source=rss-2090f88dbb94------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:39:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@updatesettings/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Light vs Dark Mode Debate, prefers-color-scheme Will Answer]]></title>
            <link>https://medium.com/gumgum-tech/light-vs-dark-mode-debate-prefers-color-scheme-will-answer-d079a5f106aa?source=rss-2090f88dbb94------2</link>
            <guid isPermaLink="false">https://medium.com/p/d079a5f106aa</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Garrett W.]]></dc:creator>
            <pubDate>Tue, 24 Aug 2021 17:46:29 GMT</pubDate>
            <atom:updated>2021-08-24T17:46:29.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Light vs dark theme mode meme: 2 options of buttons to press, one saying light mode and and one saying dark mode. man sweating." src="https://cdn-images-1.medium.com/max/500/1*XqVAd8g8XKPx2W797fcWVw.jpeg" /></figure><p>Light or dark mode? Which to make your site default?</p><p>With a simple css media query, <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme"><strong>prefers-color-scheme</strong></a>, you can read the minds of users (well their operating system preferences).</p><p>Light and dark mode has become a widely adopted appearance setting found in most operating systems today. Users have already taken the time to set their OS preferences, so don’t make them have to click around to change the theme of your app/site.</p><p>With <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme"><strong>prefers-color-scheme</strong></a> you can control more than just color, but for the purpose of this conversation, we will demo changing the root CSS variable of the background color.</p><pre>:root {<br>	--background-color: #ffffff; /* white background */<br>}<br><br>@media (prefers-color-scheme: light) {<br>	:root {<br>	        --background-color: #ffffff; /* white background */<br>	}<br>}<br><br>@media (prefers-color-scheme: dark) {<br>	:root {<br>		--background-color: #000000; /* black background */<br>	}<br>}</pre><p>The :root is our default background color in case <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme"><strong>prefers-color-scheme</strong></a> isn’t supported. Since the default root is the same as the light mode, we can simplify the code by removing the <strong>prefers-color-scheme: light</strong>.</p><pre>:root {<br>	--background-color: #ffffff; /* white background */<br>}</pre><pre>@media (prefers-color-scheme: dark) {<br>	:root {<br>		--background-color: #000000; /* black background */<br>	}<br>}</pre><p>If the user’s appearance setting is dark mode, then we will change the background to black, otherwise it will remain white.</p><h3>Testing</h3><p>To test, you will need to go into your OS settings and change your appearance. While toggling between the two options, you should see your site/app changing as well.</p><p><strong>Mac</strong>: System Preferences &gt; General &gt; Appearance</p><p><strong>Windows</strong>: Settings &gt; Personalization &gt; Colors</p><figure><img alt="Gif of changing the settings of your computer" src="https://cdn-images-1.medium.com/max/800/1*W7SUup96jldVcveCFn8R8A.gif" /></figure><h3>CSS Only Demo: <a href="https://codepen.io/garrettbear/pen/ExmLjxR">CodePen</a></h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fgarrettbear%2Fembed%2Fpreview%2FExmLjxR%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DExmLjxR&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fgarrettbear%2Fpen%2FExmLjxR&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e093247bb95775c197cdb89eaf3cdef3/href">https://medium.com/media/e093247bb95775c197cdb89eaf3cdef3/href</a></iframe><h3>Why We Use prefers-color-scheme</h3><p>At <a href="https://gumgum.com/">GumGum</a>, we conducted a UX/UI internal survey, finding that users are split almost 50/50 for preference to using light or dark mode. For some people, it is just a personal preference that they enjoy, and for others, it is due to accessibility. Despite the users’ reasoning, there is a demand for this feature, and we give the user some power to control their experience.</p><p>We are currently working on making this available on our internal applications. It’s been something we’ve wanted to do for a while, but finding this new CSS feature has made it much easier to implement.</p><h3>Support</h3><p>Since the <strong>prefers-color-scheme</strong> media query has been out for a couple of years now, it works with most updated browsers. It’s always recommended that you have a fallback mode (default), and review the browser version support of using this query.</p><p>Can I Use is a great site for checking this info: <a href="https://caniuse.com/?search=prefers-color-scheme">https://caniuse.com/?search=prefers-color-scheme</a></p><h3>Advanced</h3><p>This demo is using pure CSS, but with a little JavaScript, multiple themes can be supported beyond system color preferences. Typically how I like to handle a full page theme is applying a custom data attribute at the highest level (HTML element). If the custom data attribute doesn’t match any options, then it will default to light mode.</p><p>Specificity plays an important role here since there is no OR logic in CSS. To avoid confusion between CSS and JS on checking user themes, we will control all of the theme from JS.</p><p>In the demo below, we have a select input that takes precedence over the system settings. We are watching for a change in system color settings with <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia">window.matchMedia</a>, and if the input is set to system, then it will change, otherwise it will stay with the selected value.</p><h3>JS Demo: <a href="https://codepen.io/garrettbear/pen/GRmeWmL">CodePen</a></h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fgarrettbear%2Fembed%2Fpreview%2FGRmeWmL%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DGRmeWmL&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fgarrettbear%2Fpen%2FGRmeWmL&amp;image=https%3A%2F%2Fassets.codepen.io%2F868359%2Finternal%2Fscreenshots%2Fpens%2FGRmeWmL.default.png%3Ffit%3Dcover%26format%3Dauto%26ha%3Dfalse%26height%3D540%26quality%3D75%26v%3D2%26version%3D1628864947%26width%3D960&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cd772054fdb7e09f2aa3c8053d545c3/href">https://medium.com/media/2cd772054fdb7e09f2aa3c8053d545c3/href</a></iframe><h3>Summary</h3><p>It’s been a couple of years since <strong>prefer-color-scheme</strong> became available and by now it has good support. The CSS community over the last few years has begun to introduce new features that previously required JS, and we look forward to taking advantage of them in our <a href="https://www.npmjs.com/package/gumgum-design">GumGum Design System</a>.</p><p><strong>Prefer-color-scheme</strong> is a great CSS opportunity to enhance UX and UI of any website or web application.</p><figure><img alt="Sponge bob square pants looking at a rainbow with text @Media:Prefers-color-scheme" src="https://cdn-images-1.medium.com/max/620/1*y4Drcb8V8VP8AMSrc7WJLA.jpeg" /></figure><p>We’re always looking for new talent! <a href="https://gumgum.com/careers">View jobs</a>.</p><p>Follow us: <a href="https://www.facebook.com/gumguminc">Facebook</a> | <a href="https://twitter.com/gumgum">Twitter</a> | | <a href="https://www.linkedin.com/company/167379/">Linkedin</a> | <a href="https://www.instagram.com/gumgum/">Instagram</a></p><h4>References</h4><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries#media_features">https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries#media_features</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia">https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d079a5f106aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gumgum-tech/light-vs-dark-mode-debate-prefers-color-scheme-will-answer-d079a5f106aa">Light vs Dark Mode Debate, prefers-color-scheme Will Answer</a> was originally published in <a href="https://medium.com/gumgum-tech">GumGum Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>