Repository navigation
Conversation
|
Great work! This PR goes a long way toward enabling a potential migration to Bootstrap 6. I just have two observations: Theme selector: It would be worth adding a button that lets the user toggle between dark and light themes (and vice versa), so the switch doesn't rely solely on the system preference. Tooltips in dark mode: I noticed an inconsistency in dark mode: the Dashboard tooltips have a light background, while the Schedule ones have a dark background. It would be good to unify the styling of both components to keep the visuals consistent. Thanks for the effort—everything else looks great. |
Add a css.color.mode setting (auto, light, dark; default auto). In auto mode an inline script in the page head sets Bootstrap's data-bs-theme on <html> from prefers-color-scheme before any CSS loads, and updates it live when the OS or browser setting changes. The accent theme (css.theme) was stored in data-bs-theme on <body>, which prevented Bootstrap's dark mode from ever applying. It now uses a separate data-lb-theme attribute. Dark overrides cover LibreBooking's hard-coded light colors: page background, schedule grid and labels, dashboard, dialogs, jqtree, flatpickr, FullCalendar, select2 and Trumbowyg. Accent-colored text uses a new --primary-text variable that is lightened in dark mode for contrast. Templates use bg-body / bg-body-tertiary instead of bg-white / bg-light so they adapt; the resource QR code stays white. Light mode is visually unchanged. BREAKING CHANGE: The accent theme attribute on <body> is renamed from data-bs-theme to data-lb-theme. Custom CSS (css.extension.file) that targets [data-bs-theme='<theme>'] must use [data-lb-theme='<theme>'] instead. Assisted-by: Claude:claude-opus-5-5
Bootstrap 5.3 inverts tooltips in dark mode, so reservation popups and other Bootstrap tooltips were white, while native title tooltips, such as those on the schedule toolbar icons, were dark. Give Bootstrap tooltips a raised dark surface with a border so all tooltips look the same in dark mode. Assisted-by: Claude:claude-opus-5-5
Add a color mode menu to the navigation bar with Light, Dark and Auto options, so users are not limited to the system preference. The choice is stored per browser in local storage and overrides the css.color.mode setting, which now sets the default mode. Other open tabs pick up a change made in one tab. Move the color mode script from an inline block in globalheader.tpl to Web/scripts/color-mode.js. It is still loaded before any CSS, so pages do not flash light first. Assisted-by: Claude:claude-opus-5-5
206fce4 to
09f0c50
Compare
|
Thanks for the work on the light/dark theme. It works well, but please keep in mind that the changes made here to the Therefore, you will need to ensure that these changes are replicated in the Look #1860 |

Summary
Adds a dark mode. By default it follows the browser/OS color scheme and switches live when that changes (no reload needed). Users can also pick Light, Dark or Auto from a menu in the navigation bar.
css.color.mode(LB_CSS_COLOR_MODE):auto(default),light, ordark. It sets the default mode. Unknown values fall back toauto.Web/scripts/color-mode.jsis loaded in<head>before any CSS. It sets Bootstrap 5.3'sdata-bs-themeon<html>so pages don't flash light first, and listens forprefers-color-schemechanges.[data-bs-theme='dark']overrides for LibreBooking's hard-coded light colors: page background, schedule grid and labels, dashboard, dialogs, jqtree, flatpickr, FullCalendar, select2 and Trumbowyg.--primary-textvariable, which is lightened in dark mode so the dark accent themes stay readable. Button backgrounds keep the original accent color.bg-body/bg-body-tertiaryinstead ofbg-white/bg-lightso they adapt. The resource QR code stays on white so it still scans.Breaking change
The accent theme (
css.theme) was stored indata-bs-themeon<body>. That attribute belongs to Bootstrap's color mode, so Bootstrap's dark mode could never apply. The accent theme now usesdata-lb-theme.Custom CSS loaded via
css.extension.filethat targets[data-bs-theme='<theme>']must switch to[data-lb-theme='<theme>']. This is documented inBASIC-CONFIGURATION.rstand marked with aBREAKING CHANGE:footer, so it will trigger a major release. If maintainers would rather avoid a major bump for this, I can look into a compatibility approach.Testing
Page::normalizeColorMode()intests/Pages/PageTest.php.composer phpcsfixer:lint, PHPStan,config-dist:check,env-example:check, andnpm run lint:frontendall pass.main.tests/e2e/docker) with Playwright, with the color scheme emulated as dark and light:Docs
docs/source/BASIC-CONFIGURATION.rstdocumentscss.color.mode, the color mode menu, and thedata-lb-themeselector.config/config.dist.phpand.env.exampleare regenerated.🤖 Generated with Claude Code