Skip to content

Commit

Permalink
Merge pull request #4761 from AntonKhorev:dark-mode-with-close-button
Browse files Browse the repository at this point in the history
Enable dark theme if user prefers dark color scheme - no javascript version
  • Loading branch information
gravitystorm committed Nov 13, 2024
2 parents 7f611b2 + 5e1093e commit ae00fa8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app/assets/stylesheets/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ time[title] {
100% { opacity: 1 }
}

/* Bootstrap close button overrides for nested light/dark themes */

[data-bs-theme="dark"] .btn-close {
filter: var(--bs-btn-close-white-filter);
}

[data-bs-theme="light"] .btn-close {
filter: none;
}

/* Rules for the header */

#menu-icon {
Expand Down Expand Up @@ -502,7 +512,7 @@ body.small-nav {
}

.leaflet-control-scale-line {
@extend .border-light, .border-opacity-75;
border-color: rgba(var(--bs-light-rgb), .75) !important;
}
}

Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/parameters.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ $table-border-factor: .1;
$list-group-hover-bg: rgba(var(--bs-emphasis-color-rgb), .075);

$enable-negative-margins: true;
$color-mode-type: media-query;
2 changes: 1 addition & 1 deletion app/views/layouts/_banner.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% unless (banner = next_banner()).nil? %>
<%= tag.div :id => "banner", :class => "position-relative", :data => { :bs_theme => token_list(:dark => banner[:dark]) } do %>
<%= tag.div :id => "banner", :class => "position-relative", :data => { :bs_theme => (banner[:dark] ? "dark" : "light") } do %>
<%= link_to (image_tag banner[:img], :srcset => banner[:srcset], :alt => banner[:alt], :title => banner[:alt]), banner[:link] %>
<button type="button"
class="btn-close position-absolute top-0 end-0 m-4 opacity-100 bg-white bg-opacity-50"
Expand Down

0 comments on commit ae00fa8

Please sign in to comment.