WorkTracker/Components/App.razor
MaddoScientisto 158906fa28 feat: add theme mode support with AppThemeMode enum and AppThemeState service
- Introduced AppThemeMode enum to define theme options: System, Light, Dark.
- Updated AppSettingsDocument to include ThemeMode property.
- Created AppThemeState service to manage current theme mode and handle changes.
- Integrated theme mode handling in CouchbaseLiteAppSettingsService for persistence.
- Added JavaScript for theme management in the frontend, supporting system preference detection.
- Enhanced CSS with theme variables for consistent styling across light and dark modes.
- Updated Playwright tests to ensure sidebar functionality and responsiveness.
2026-04-20 22:58:25 +02:00

44 lines
1.5 KiB
Text

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<script>
(function () {
try {
var storageKey = "worktracker.themeMode";
var mode = localStorage.getItem(storageKey) || "system";
if (mode !== "light" && mode !== "dark" && mode !== "system") {
mode = "system";
}
var prefersDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
var effectiveMode = mode === "system"
? (prefersDark ? "dark" : "light")
: mode;
document.documentElement.setAttribute("data-bs-theme", effectiveMode);
document.documentElement.setAttribute("data-theme-mode", mode);
document.documentElement.style.colorScheme = effectiveMode;
}
catch {
}
})();
</script>
<link rel="stylesheet" href="@Assets["lib/bootstrap/dist/css/bootstrap.min.css"]" />
<link rel="stylesheet" href="@Assets["app.css"]" />
<link rel="stylesheet" href="@Assets["WorkTracker.styles.css"]" />
<ImportMap />
<link rel="icon" type="image/png" href="favicon.png" />
<HeadOutlet />
</head>
<body>
<Routes @rendermode="InteractiveServer" />
<script src="@Assets["theme.js"]"></script>
<script src="_framework/blazor.web.js"></script>
</body>
</html>