aboutsummaryrefslogtreecommitdiff
path: root/build/safari-default-dark-mode/index.html
diff options
context:
space:
mode:
authorBradley Taunt <bt@btxx.org>2024-06-08 13:43:37 -0400
committerBradley Taunt <bt@btxx.org>2024-06-08 13:43:37 -0400
commit16d28628aca9b2d356de31c319f5e7bc0f5b2b02 (patch)
tree11947abb71e38cbe75116871694a44c33d257763 /build/safari-default-dark-mode/index.html
parentdcfb172704f3afb68a30425029ec834be2883274 (diff)
Remove incorrectly generated files, fix up markdown articles
Diffstat (limited to 'build/safari-default-dark-mode/index.html')
-rw-r--r--build/safari-default-dark-mode/index.html23
1 files changed, 2 insertions, 21 deletions
diff --git a/build/safari-default-dark-mode/index.html b/build/safari-default-dark-mode/index.html
index e2c3cc7..d68e11c 100644
--- a/build/safari-default-dark-mode/index.html
+++ b/build/safari-default-dark-mode/index.html
@@ -3,11 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="dark light">
<link rel="icon" href="data:,">
<title>Dear Apple, Please Fix Safari's Default Dark Mode Link Color</title>
<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
-<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>
<nav>
@@ -16,37 +17,23 @@
<main>
<h1 id="dear-apple-please-fix-safaris-default-dark-mode-link-color">Dear Apple, Please Fix Safari&#8217;s Default Dark Mode Link Color</h1>
-
<p>2022-04-18</p>
-
<p>Supporting dark mode on the modern web falls under the realm of accessibility and should not be ignored. It is important and helps keep the visual flow of your content to match that of your users&#8217; operating system UI. Not to mention, it&#8217;s easy to implement and keep consistent across browsers.</p>
-
<h2 id="support-dark-mode-with-zero-css">Support Dark Mode with Zero CSS</h2>
-
<p>A common practice is to include a <code>@media</code> query via CSS to target styling changes based on whether <code>dark-mode</code> is active. I tend to believe this is overkill for basic websites. Many developers aren&#8217;t aware of the HTML <code>color-scheme</code> parameter. (This website itself is using it in place of CSS media queries)</p>
-
<h3 id="html-color-scheme">HTML &#8220;color-scheme&#8221;</h3>
-
<p>Adding the following meta tag inside your document&#8217;s <code>head</code> element, you can enable dark mode instantly with zero configuration:</p>
-
<pre><code>&#60;meta name="color-scheme" content="dark light" &#47;&#62;
</code></pre>
-
<p>There are minor caveats:</p>
-
<ol>
<li>You should not be specifying any <code>background</code> styling to your <code>body</code> or <code>html</code> elements</li>
<li>You should be not specifying any <code>color</code> styling across any of your readable content (paragraphs, headings, lists, blockquotes)</li>
</ol>
-
<p>That&#8217;s it! In case you were curious, all major browsers support this color scheme meta tag: <a href="https://caniuse.com/mdn-html_elements_meta_name_color-scheme">https:&#47;&#47;caniuse.com&#47;mdn-html<em>elements</em>meta<em>name</em>color-scheme</a></p>
-
<h2 id="but-wait-whats-this-about-safari">But Wait, What&#8217;s This About Safari?</h2>
-
<p>Even though by adding the color-scheme meta tag we get ourselves good dark mode support across all browsers - Safari has one big oversight: link color. Take a look at the comparison screenshots below (based on one of my older articles). The first one is taken in Firefox, the second in Safari:</p>
-
<p>Luckily for us there is a simple solution using minimal amounts of CSS[^1]:</p>
-
<pre><code>@supports (color-scheme: dark light) {
@media screen and (prefers-color-scheme: dark) {
a:link {color: #9e9eff;}
@@ -55,17 +42,11 @@
}
}
</code></pre>
-
<p>We are brute-forcing Safari to implement the same color HEX codes used by both Firefox and Chrome browsers. How a horrible accessibility oversight could happen within a company as large as Apple is astounding&#8230;</p>
-
<h2 id="apple-fix-your-browsers-dark-mode">Apple: Fix Your Browser&#8217;s Dark Mode</h2>
-
<p>My hope if that even one Safari design or development team member stumbles across this article and raises this ticket to the rest of the team[^2]. It&#8217;s an unbelievably easy fix and would save developers the headache of overriding these things ourselves.</p>
-
<p>Thanks for reading and happy dark mode to you all!</p>
-
<h2 id="refs">Refs</h2>
-
<ol>
<li>Special thanks to <a href="https://seirdy.one/">Seirdy</a> for suggesting the use of :link and :active support. I recommend you check out his take on <a href="https://seirdy.one/2020/11/23/website-best-practices.html#dark-themes">dark mode &#47; theme support</a>.</li>
<li>This has an open ticket through <a href="https://bugs.webkit.org/show_bug.cgi?id=209851">Webkit Bugzilla</a></li>