mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Add dark mode; align table headers with numeric columns
Dark mode: - Theme toggle in the header (System → Light → Dark); "System" follows the OS setting and its changes. The choice is kept per browser and applied before first paint, so there's no light flash. - Implemented by remapping the palette under :root[data-theme=dark]: grays flip, color tints become translucent, dark colored text becomes its light counterpart. Page, surface, header and accent colors are semantic tokens. Native controls follow via color-scheme. - Chart text and grid colors follow the theme. - Public share pages get the toggle too. - Contrast checked against WCAG 4.5:1 (primary button text and error text adjusted for dark). Tables: - Shared table style no longer forces header text left, so right-aligned numeric headers line up with their columns everywhere. - Flight log: units in headers, muted dashes for empty cells, GPS marker beside the route instead of its own column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5bf682502b
commit
86aadfcf6c
13 files changed
+216
-25
No files matched your search
@@ -6,6 +6,6 @@
|
||||
data: { airport_autocomplete_target: "input",
|
||||
action: "input->airport-autocomplete#search keydown->airport-autocomplete#keydown blur->airport-autocomplete#blur" } %>
|
||||
<ul data-airport-autocomplete-target="list" role="listbox" hidden
|
||||
class="absolute z-20 mt-1 max-h-72 w-[min(28rem,90vw)] overflow-auto rounded-md bg-white py-1 shadow-lg ring-1 ring-slate-200"></ul>
|
||||
class="absolute z-20 mt-1 max-h-72 w-[min(28rem,90vw)] overflow-auto rounded-md bg-surface py-1 shadow-lg ring-1 ring-slate-200"></ul>
|
||||
<p class="hint min-h-4" data-airport-autocomplete-target="hint"></p>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<%# Applies the saved theme before the page paints (no light flash in dark mode).
|
||||
"system" (default) follows the OS setting. Set by theme_controller.js. %>
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
var choice = localStorage.getItem("theme") || "system";
|
||||
var dark = choice === "dark" || (choice === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
||||
document.documentElement.dataset.theme = dark ? "dark" : "light";
|
||||
} catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,7 @@
|
||||
<%# Cycles System → Light → Dark. Icons are swapped by theme_controller.js. %>
|
||||
<button type="button" data-controller="theme" data-action="theme#cycle" data-theme-target="button"
|
||||
class="rounded p-1 text-white/80 hover:bg-white/10 hover:text-white" title="Theme: System" aria-label="Theme: System">
|
||||
<svg data-theme-icon="system" class="h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg>
|
||||
<svg data-theme-icon="light" class="hidden h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
|
||||
<svg data-theme-icon="dark" class="hidden h-5 w-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>
|
||||
</button>
|
||||
Reference in new issue
Block a user