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.

index.html 11KB

3 년 전
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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>
  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>Why light text on dark background is a bad idea (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="#f0f0ea">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f0f0ea">
  26. <!-- Documented, feel free to shoot an email. -->
  27. <link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
  28. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  29. <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>
  30. <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>
  31. <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>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <script>
  36. function toggleTheme(themeName) {
  37. document.documentElement.classList.toggle(
  38. 'forced-dark',
  39. themeName === 'dark'
  40. )
  41. document.documentElement.classList.toggle(
  42. 'forced-light',
  43. themeName === 'light'
  44. )
  45. }
  46. const selectedTheme = localStorage.getItem('theme')
  47. if (selectedTheme !== 'undefined') {
  48. toggleTheme(selectedTheme)
  49. }
  50. </script>
  51. <meta name="robots" content="noindex, nofollow">
  52. <meta content="origin-when-cross-origin" name="referrer">
  53. <!-- Canonical URL for SEO purposes -->
  54. <link rel="canonical" href="https://tatham.blog/2008/10/13/why-light-text-on-dark-background-is-a-bad-idea/">
  55. <body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick">
  56. <article>
  57. <header>
  58. <h1>Why light text on dark background is a bad idea</h1>
  59. </header>
  60. <nav>
  61. <p class="center">
  62. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  63. <use xlink:href="/static/david/icons2/symbol-defs.svg#icon-home"></use>
  64. </svg> Accueil</a> •
  65. <a href="https://tatham.blog/2008/10/13/why-light-text-on-dark-background-is-a-bad-idea/" title="Lien vers le contenu original">Source originale</a>
  66. </p>
  67. </nav>
  68. <hr>
  69. <p><strong>Update, Oct 2014:</strong> This post was written in 2008, based on me scrounging together some complementary links at the time. It’s now 2014, and accessibility is a well thought-out problem, which is generally well solved. Use the colour scheme that makes you happy. I use a black background on my Windows Phone, a dark navy in Sublime Text, a mid-grey chrome around my Office documents, and a bright white background through Outlook and my email.</p>
  70. <p><hr>
  71. <p>As this is a suggestion which comes up quite regularly, I felt it valuable to document some of the research I have collected about the readability of light text on dark backgrounds.</p>
  72. <p>The science of readability is by no means new, and some of the best research comes from advertising works in the early 80s. This information is still relevant today.</p>
  73. <p>First up is this quote from a paper titled “Improving the legibility of visual display units through contrast reversal”. In present time we think of contrast reversal meaning black-on-white, but remember this paper is from 1980 when VDUs (monitors) where green-on-black. This paper formed part of the research that drove the push for this to change to the screen formats we use today.</p>
  74. <blockquote><p>However, most studies have shown that dark characters on a light background are superior to light characters on a dark background (when the refresh rate is fairly high). For example, Bauer and Cavonius (1980) found that participants were 26% more accurate in reading text when they read it with dark characters on a light background.</p>
  75. <p>Reference: Bauer, D., &amp; Cavonius, C., R. (1980). Improving the legibility of visual display units through contrast reversal. In E. Grandjean, E. Vigliani (Eds.), Ergonomic Aspects of Visual Display Terminals (pp. 137-142). London: Taylor &amp; Francis</p></blockquote>
  76. <p>Ok, 26% improvement – but why?</p>
  77. <blockquote><p>People with astigmatism (aproximately 50% of the population) find it harder to read white text on black than black text on white. Part of this has to do with light levels: with a bright display (white background) the iris closes a bit more, decreasing the effect of the “deformed” lens; with a dark display (black background) the iris opens to receive more light and the deformation of the lens creates a much fuzzier focus at the eye.</p>
  78. <p><a href="http://www.cs.ubc.ca/labs/spin/people/harrison-jason.html" target="_blank">Jason Harrison</a> – Post Doctoral Fellow, Imager Lab Manager – Sensory Perception and Interaction Research Group, University of British Columbia</p></blockquote>
  79. <p>The “fuzzing” effect that Jason refers to is known as halation.</p>
  80. <p>It might feel strange pushing your primary design goals based on the vision impaired, but when 50% of the population of have this “impairment” it’s actually closer to being the norm than an impairment.</p>
  81. <p>The web is rife with research on the topic, but I think these two quotes provide a succinct justification for why light text on a dark background is a bad idea.</p></p>
  82. </article>
  83. <hr>
  84. <footer>
  85. <p>
  86. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  87. <use xlink:href="/static/david/icons2/symbol-defs.svg#icon-home"></use>
  88. </svg> Accueil</a> •
  89. <a href="/david/log/" title="Accès au flux RSS"><svg class="icon icon-rss2">
  90. <use xlink:href="/static/david/icons2/symbol-defs.svg#icon-rss2"></use>
  91. </svg> RSS</a> •
  92. <a href="http://larlet.com" title="Go to my English profile" data-instant><svg class="icon icon-user-tie">
  93. <use xlink:href="/static/david/icons2/symbol-defs.svg#icon-user-tie"></use>
  94. </svg> Pro</a> •
  95. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel"><svg class="icon icon-mail">
  96. <use xlink:href="/static/david/icons2/symbol-defs.svg#icon-mail"></use>
  97. </svg> Email</a> •
  98. <abbr class="nowrap" title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"><svg class="icon icon-hammer2">
  99. <use xlink:href="/static/david/icons2/symbol-defs.svg#icon-hammer2"></use>
  100. </svg> Légal</abbr>
  101. </p>
  102. <template id="theme-selector">
  103. <form>
  104. <fieldset>
  105. <legend><svg class="icon icon-brightness-contrast">
  106. <use xlink:href="/static/david/icons2/symbol-defs.svg#icon-brightness-contrast"></use>
  107. </svg> Thème</legend>
  108. <label>
  109. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  110. </label>
  111. <label>
  112. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  113. </label>
  114. <label>
  115. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  116. </label>
  117. </fieldset>
  118. </form>
  119. </template>
  120. </footer>
  121. <script>
  122. function loadThemeForm(templateName) {
  123. const themeSelectorTemplate = document.querySelector(templateName)
  124. const form = themeSelectorTemplate.content.firstElementChild
  125. themeSelectorTemplate.replaceWith(form)
  126. form.addEventListener('change', (e) => {
  127. const chosenColorScheme = e.target.value
  128. localStorage.setItem('theme', chosenColorScheme)
  129. toggleTheme(chosenColorScheme)
  130. })
  131. const selectedTheme = localStorage.getItem('theme')
  132. if (selectedTheme && selectedTheme !== 'undefined') {
  133. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  134. }
  135. }
  136. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  137. window.addEventListener('load', () => {
  138. let hasDarkRules = false
  139. for (const styleSheet of Array.from(document.styleSheets)) {
  140. let mediaRules = []
  141. for (const cssRule of styleSheet.cssRules) {
  142. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  143. continue
  144. }
  145. // WARNING: Safari does not have/supports `conditionText`.
  146. if (cssRule.conditionText) {
  147. if (cssRule.conditionText !== prefersColorSchemeDark) {
  148. continue
  149. }
  150. } else {
  151. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  152. continue
  153. }
  154. }
  155. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  156. }
  157. // WARNING: do not try to insert a Rule to a styleSheet you are
  158. // currently iterating on, otherwise the browser will be stuck
  159. // in a infinite loop…
  160. for (const mediaRule of mediaRules) {
  161. styleSheet.insertRule(mediaRule.cssText)
  162. hasDarkRules = true
  163. }
  164. }
  165. if (hasDarkRules) {
  166. loadThemeForm('#theme-selector')
  167. }
  168. })
  169. </script>
  170. </body>
  171. </html>