<p dir="auto">We probably can enable dark mode now.</p>
<p dir="auto">This version uses system settings with media queries and doesn't need javascript. It is enabled by the Bootstrap option <a href="https://getbootstrap.com/docs/5.3/customize/color-modes/#building-with-sass" rel="nofollow"><code class="notranslate">$color-mode-type: media-query</code></a>. Previous version <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2229239704" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/4653" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/4653/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/4653">#4653</a> used javascript to track system settings and change <code class="notranslate">data-bs-theme</code> attributes accordingly.</p>
<p dir="auto">The problem with this no-javascript approach is that <code class="notranslate">data-bs-theme</code> attributes are ignored. But we're already using them for inverting close buttons on dark banners. When in light mode, dark banners have their close buttons inverted because banners themselves have a dark theme attribute. Aside from not working with <code class="notranslate">$color-mode-type: media-query</code>, this approach has another drawback: you can't invert buttons on light banners in dark mode. Once the entire webpage gets its dark mode attribute, you can't go back to light mode.</p>
<p dir="auto">The solution in this PR is:</p>
<ul dir="auto">
<li>use <code class="notranslate">$color-mode-type: media-query</code> that will take care of most of light/dark mode styling</li>
<li>use <code class="notranslate">data-bs-theme</code> on banners</li>
<li>add css to enable/disable close button inversion inside elements with <code class="notranslate">data-bs-theme</code></li>
</ul>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/4761'>https://github.com/openstreetmap/openstreetmap-website/pull/4761</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761/commits/a147700c920a74a5a3d6929d52897ec0468714bb" class="commit-link">a147700</a>  Set both light and dark banner themes</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761/commits/fef37129e293ec88bf9e2a84dab406921cedbc88" class="commit-link">fef3712</a>  Override Bootstrap close button inversion inside themed elements</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761/commits/f53c580e8c7e8d5424753aa2337fa7b82a0a6fdf" class="commit-link">f53c580</a>  Enable dark mode using media queries</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761/files">3 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761/files#diff-e86a39e6d0b163f152db8843fc7d647a3f5d648de4a74f1732bef4474b6e5bc8">app/assets/stylesheets/common.scss</a>
    (10)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761/files#diff-d2e82deee467e04b34fde66bc330f96ed2020aefc541445c1d576a56612ee71b">app/assets/stylesheets/parameters.scss</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761/files#diff-24e67bdbd0998dcc1abb24b30381fe87f4f79f1ba28d08a79057202aa5ebb4ff">app/views/layouts/_banner.html.erb</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/4761.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/4761.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/4761.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/4761.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4761">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPYNXATO6RSHAH4NETZA6OYPAVCNFSM6AAAAABHJIDMAWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4DCMJVGUZDAMQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLO44WFPB5TRSABZ4D3ZA6OYPA5CNFSM6AAAAABHJIDMAWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHIP55KQI.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4761</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4761",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4761",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>