A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the `title` element
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>Top 9 UX Trends to Watch out in 2022 (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f7f7f7">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f7f7f7" media="(prefers-color-scheme: light)">
  26. <meta name="theme-color" content="#272727" media="(prefers-color-scheme: dark)">
  27. <!-- Documented, feel free to shoot an email. -->
  28. <link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
  29. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  36. <script>
  37. function toggleTheme(themeName) {
  38. document.documentElement.classList.toggle(
  39. 'forced-dark',
  40. themeName === 'dark'
  41. )
  42. document.documentElement.classList.toggle(
  43. 'forced-light',
  44. themeName === 'light'
  45. )
  46. }
  47. const selectedTheme = localStorage.getItem('theme')
  48. if (selectedTheme !== 'undefined') {
  49. toggleTheme(selectedTheme)
  50. }
  51. </script>
  52. <meta name="robots" content="noindex, nofollow">
  53. <meta content="origin-when-cross-origin" name="referrer">
  54. <!-- Canonical URL for SEO purposes -->
  55. <link rel="canonical" href="https://uxplanet.org/top-9-ux-trends-to-watch-ut-in-2022-9dfc1eeb25a8">
  56. <body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick" data-instant-intensity="viewport-all">
  57. <article>
  58. <header>
  59. <h1>Top 9 UX Trends to Watch out in 2022</h1>
  60. </header>
  61. <nav>
  62. <p class="center">
  63. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  64. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  65. </svg> Accueil</a> •
  66. <a href="https://uxplanet.org/top-9-ux-trends-to-watch-ut-in-2022-9dfc1eeb25a8" title="Lien vers le contenu original">Source originale</a>
  67. </p>
  68. </nav>
  69. <hr>
  70. <p id="7dc2" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">As we roll into another year of new COVID variants, new social distancing rules, and constantly updating work from home rules, we caught ourselves thinking about what 2022 will look like for UX (user experience )trends. With more time to reflect at home, designers around the world have had a unique opportunity to come up with innovative products and rebuild existing ones. This year, let’s realign with ourselves and understand who we are as designers and what makes us tick.</p>
  71. <p id="c90d" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">For this year’s trends, we’ve rounded up some of the classic as well as up and coming features that we believe will be the biggest UX trends this year 2022.</p>
  72. <h2 id="d05f" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">1. Passwordless Login</h2>
  73. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  74. <p id="7324" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">The average user uses at least 30 apps per month, remembering every password is quite a task. Often, a password is required to be a combination of numbers, special characters, and letters, which makes it more difficult to remember. And when we do forget, it becomes super frustrating as we have to go through the whole “forgot password” routine.</p>
  75. <p id="a782" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">A simple solution is a transition to “passwordless” logins. Passwordless logins work like a charm — logging in through your Google account, social media accounts, fingerprints, iris scans, or phone unlock patterns that are just a few taps away!</p>
  76. <p id="51d1" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Microsoft is an example of a brand that has worked hard on removing passwords. Microsoft’s Windows 10 Version 2004 introduced a solution called “Windows 10 Hello,” a biometric system to sign in. Users can now sign in using fingerprint, iris scan, face scan, or a pattern.</p>
  77. <p id="4e97" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Biometric authentication is one technology that can embrace a security-first approach for both the businesses and the users, thus improving User Experience substantially. The promising biometric authentication market has been giving identity to people without being at risk of being impersonated.</p>
  78. <h2 id="5c3f" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">2. Scrollytelling</h2>
  79. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  80. <p id="14cc" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Scrolling is an interaction of the past; apps and websites are rapidly moving towards the idea of ‘scrollytelling’. In this experience, the user sees each element on the page come to life through micro-interactions and creative storytelling through the action of scrolling down. There are no clicks, no hassle of choice, and no pop-ups.</p>
  81. <p id="b103" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Users are no longer interested in seeing a long page filled with information; they want to be a part of the narrative — much like in a video game. Scrollytelling does exactly this by providing a more immersive way to engage users.</p>
  82. <p id="ae14" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">This interaction requires designers to not only create cool visuals, but to also think of the story that we want to share, it’s plot, and the people we are telling it to.</p>
  83. <h2 id="3594" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">3. Air Gesture Control</h2>
  84. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  85. <p id="00d2" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Air Gesture Control is a touchless mechanism that allows users to control their devices through bodily gestures and air movements. Movements such as waving, pinching, opening of the palms, sliding or swiping, can all be used to initiate various actions. An example of this is users showing their palms to their mobile phones to open the front-facing camera and capture a selfie.</p>
  86. <p id="81af" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">The Google Pixel 4 is fitted with a motion-sensing radar to facilitate many of these touchless interactions, making it a one of its kind device. We will see air gesture control being integrated across the board in 2022 as touchless interactions continue to gain traction in wake of an onslaught of yet more variants of the Covid-19 pandemic.</p>
  87. <h2 id="2308" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">4. Material Design and Desigining For Larger Screens</h2>
  88. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  89. <p id="d5f5" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">With people spending more time on their devices than ever before, screen sizes have been drastically increasing. Companies like Google have begun to adapt and optimize their design systems to respond to these new requirements.</p>
  90. <p id="a276" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">This will have a knock-on effect on the entire industry with other competitors looking to jump on the train to compete with Material Design based applications. The rise in popularity of foldables and tablets will mean a greater number of designs for all form factors, and layout and component based responsiveness across devices. We all know that design based considerations are different for mobile and web. 2022 could just be the year to herald in a new age of synchronous design across screen sizes.</p>
  91. <h2 id="bf22" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">5. Advanced Personalisation</h2>
  92. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  93. <p id="d15d" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Advanced personalization makes use of emotive and sensory design in order to fine-tune technology to every need and want of an individual user.</p>
  94. <p id="73c9" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Personalized UX is a very powerful tool for designers and businesses alike — we have all experienced it via what appears in our Netflix feed, the types of ads we see on Instagram, or the related products that appear while browsing through Amazon.</p>
  95. <p id="95dd" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Not just from a user experience standpoint, but when users see personalized options, they are more likely to convert. In a world where we’re overwhelmed with options every time we open a device or website, personalization can make all the difference in what products we choose to accept into our lives.</p>
  96. <p id="9ff1" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">“33% of customers who abandon business relationships do so because personalization is lacking.” — <a class="cr kg" href="https://www.customerthermometer.com/customer-service/customer-service-and-satisfaction-statistics-for-2020/" rel="noopener ugc nofollow" target="_blank">Accenture</a></p>
  97. <h2 id="784d" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">6. Inclusive Design</h2>
  98. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  99. <p id="d2a1" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Inclusive design has been widely spoken about especially since the pandemic hit and a majority of businesses started going online. Yet most websites in India haven’t been implementing it because there is an assumption that it doesn’t make any commercial sense. The truth is it does. Being mindful and designing for people with disabilities or people who aren’t as tech savvy as us or people that don’t fall into the binary world that we are all so used to will only expand the business market and in the long run it ensures better user experience across the board.</p>
  100. <p id="1bb1" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Companies like Microsoft, now see the potential of being inclusive. By announcing that they will be giving special attention to accessibility in 2022, they have now set a path. Even Google has been aggressively addressing the need for inclusive design. It’s time we do too.</p>
  101. <p id="ba65" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Inclusive design revolves around two basic principles -</p>
  102. <ul class=""><li id="899c" class="ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq kh ki kj bx">Recognizing Bias and Exclusion: It is about understanding whose perspective is included in the UX decisions and whose perspective gets excluded.</li><li id="b9b0" class="ht hu ec hv b hw kk hy hz ia kl ic id ie km ig ih ii kn ik il im ko io ip iq kh ki kj bx">Solve for One, Extend to Many: It’s always useful to consider the full spectrum of possible users for the product and design for the extreme cases. This ultimately ensures accessibility and usability for a wider audience.</li></ul>
  103. <p id="5fe7" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Web Content Accessibility Guidelines (WCAG) is a great resource that offers numerous methodologies of creating accessible and inclusive web design. Intercom Messenger is an interesting example as it follows all WCAG regulations providing screen reader support, keyboard navigation, and a restrained color palette.</p>
  104. <p id="fea3" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">A well-drafted text is also an important part of inclusive UX design. For example, it’s always better to use neutral forms. Instead of referring to your audience as ‘guys’, ‘Mr.’, ‘Ms.’ use gender-neutral forms like ‘friends’, ‘users’, and so on.</p>
  105. <p id="af13" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">“The right microcopy can build an iconic brand and an unforgettable user experience for your customers, alongside improving conversions anywhere between 14.79% and 166.66%.” — Joshua Porter, Father of Microcopy</p>
  106. <h2 id="0754" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">7. Artificial Intelligence (AI)</h2>
  107. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  108. <p id="b79b" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Artificial intelligence (AI) is a term used to describe any intelligence expressed by machines or computerized technologies. The potential for AI within <a class="cr kg" href="https://www.lollypop.design/services" rel="noopener ugc nofollow" target="_blank">UX design</a> is quite impressive — especially in subspecialties like user research and information architecture. AI can easily be programmed to create large numbers of wireframes based on our requirements and best practices found on the web. This would optimize the design process and help us deliver solutions much more efficiently.</p>
  109. <p id="03c4" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">While AI has a very promising scope, it is beneficial to remember that behind every AI is a human that programmed it, which means that it is not always neutral or without flaws. Designers must find a way to get rid of these possible biases.</p>
  110. <h2 id="4a22" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">8. Remote and Virtual Collaboration</h2>
  111. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  112. <p id="fe72" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">2021 saw us adopt remote user research, usability testing, and virtual whiteboarding en-masse. This remote revolution has led to an increase in the popularity of collaborative design tools like Figma and Miro, which have a short learning curve and allow for greater collaborative iteration.</p>
  113. <p id="35e4" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">More seats at the table mean better ideation and shorter turnaround times, a huge benefit to the industry; and while some of these remote methodologies still need to be optimized to get rid of inherent biases which would affect outcomes, we see this as a pattern that is here to stay in the long run.</p>
  114. <p id="c729" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">An increasing number of applications are being re-designed to keep pace with the Figmas and Miros of the world, so live virtual collaboration is only going to get better over the next few years. The burden of proof will soon lean towards “why does this have to be done in person when it can happen just as effectively in a remote setting?”</p>
  115. <h2 id="ef65" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">9. Responding To The Metaverse</h2>
  116. <figure class="jn jo jp jq jr hm dh di paragraph-image"></figure>
  117. <p id="a295" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">The Metaverse is a digital universe that has been constructed using technological elements such as AR, VR and video, in which users live. The big push for the Metaverse by the likes of Facebook (now Meta), Microsoft, and Roblox will have a whole new set of design and research implications in UX; because here, design is more concerned with creating an immersive experience, rather than focusing on how quickly a task can be accomplished. Think of the metaverse as a grand culmination of all of these aspects of engagement and interaction.</p>
  118. <p id="eb0e" class="pw-post-body-paragraph ht hu ec hv b hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq dv bx">Although it may be a few years before the Metaverse becomes a part of the mainstream, we can be sure that the lines between our digital and physical selves will continue to blur till then. Advancements in AR, VR, and AI will soon make user avatars, 3D visualizations, and other features associated with extended reality more accessible, so product design innovations that support this eventual shift, will have the potential for real impact. As UX practitioners, the time is rife to till the ground to usher in this new era of virtual interaction.</p>
  119. <h2 id="98c9" class="ir is ec bl bm it iu hy iv iw ix ic iy iz ja jb jc jd je jf jg jh ji jj jk jl bx">Conclusion</h2>
  120. <p id="34c6" class="pw-post-body-paragraph ht hu ec hv b hw kp hy hz ia kq ic id ie kr ig ih ii ks ik il im kt io ip iq dv bx">Now that we’ve had a look at some of the UX (User experience) trends that this new year will bring us, it’s also a good time to talk about how UX design is going to get more and more specialized in the coming years. This is going to directly impact the UX Maturity seen in various organizations — a structured UX Maturity level will become the norm and an integrated UX Maturity stage is what we will strive for. There will be a drastic shift in the work culture, not just where we work from but how we collaborate with each other and how we design for our future generations.</p>
  121. </article>
  122. <hr>
  123. <footer>
  124. <p>
  125. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  126. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  127. </svg> Accueil</a> •
  128. <a href="/david/log/" title="Accès au flux RSS"><svg class="icon icon-rss2">
  129. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-rss2"></use>
  130. </svg> Suivre</a> •
  131. <a href="http://larlet.com" title="Go to my English profile" data-instant><svg class="icon icon-user-tie">
  132. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-user-tie"></use>
  133. </svg> Pro</a> •
  134. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel"><svg class="icon icon-mail">
  135. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-mail"></use>
  136. </svg> Email</a> •
  137. <abbr class="nowrap" title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"><svg class="icon icon-hammer2">
  138. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-hammer2"></use>
  139. </svg> Légal</abbr>
  140. </p>
  141. <template id="theme-selector">
  142. <form>
  143. <fieldset>
  144. <legend><svg class="icon icon-brightness-contrast">
  145. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-brightness-contrast"></use>
  146. </svg> Thème</legend>
  147. <label>
  148. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  149. </label>
  150. <label>
  151. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  152. </label>
  153. <label>
  154. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  155. </label>
  156. </fieldset>
  157. </form>
  158. </template>
  159. </footer>
  160. <script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
  161. <script>
  162. function loadThemeForm(templateName) {
  163. const themeSelectorTemplate = document.querySelector(templateName)
  164. const form = themeSelectorTemplate.content.firstElementChild
  165. themeSelectorTemplate.replaceWith(form)
  166. form.addEventListener('change', (e) => {
  167. const chosenColorScheme = e.target.value
  168. localStorage.setItem('theme', chosenColorScheme)
  169. toggleTheme(chosenColorScheme)
  170. })
  171. const selectedTheme = localStorage.getItem('theme')
  172. if (selectedTheme && selectedTheme !== 'undefined') {
  173. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  174. }
  175. }
  176. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  177. window.addEventListener('load', () => {
  178. let hasDarkRules = false
  179. for (const styleSheet of Array.from(document.styleSheets)) {
  180. let mediaRules = []
  181. for (const cssRule of styleSheet.cssRules) {
  182. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  183. continue
  184. }
  185. // WARNING: Safari does not have/supports `conditionText`.
  186. if (cssRule.conditionText) {
  187. if (cssRule.conditionText !== prefersColorSchemeDark) {
  188. continue
  189. }
  190. } else {
  191. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  192. continue
  193. }
  194. }
  195. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  196. }
  197. // WARNING: do not try to insert a Rule to a styleSheet you are
  198. // currently iterating on, otherwise the browser will be stuck
  199. // in a infinite loop…
  200. for (const mediaRule of mediaRules) {
  201. styleSheet.insertRule(mediaRule.cssText)
  202. hasDarkRules = true
  203. }
  204. }
  205. if (hasDarkRules) {
  206. loadThemeForm('#theme-selector')
  207. }
  208. })
  209. </script>
  210. </body>
  211. </html>