Add light/dark theme switch
Theme follows the system by default; the header switch cycles auto/light/dark and is stored per browser. The presenter has its own switch (T), dark by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f0c6687100
commit
58145e9753
9 files changed
+187
-18
No files matched your search
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Button that cycles the colour scheme (wired up by webroot/js/plenario.js `Theme`).
|
||||
* Without JavaScript it stays hidden, the system setting applies.
|
||||
*
|
||||
* @var \App\View\AppView $this
|
||||
* @var string $key localStorage key, same as in element theme_init
|
||||
* @var string $modes Comma separated cycle order of auto|light|dark
|
||||
* @var string $class CSS class of the button
|
||||
*/
|
||||
$key ??= 'plenario-theme';
|
||||
$modes ??= 'auto,light,dark';
|
||||
$class ??= 'theme-switch';
|
||||
?>
|
||||
<button type="button" class="<?= h($class) ?>" data-theme-switch hidden
|
||||
data-theme-key="<?= h($key) ?>" data-theme-modes="<?= h($modes) ?>"
|
||||
data-label-auto="<?= __('Automatisch') ?>" data-label-light="<?= __('Hell') ?>" data-label-dark="<?= __('Dunkel') ?>"
|
||||
data-label-prefix="<?= __('Farbschema') ?>" data-label-next="<?= __('wechseln zu') ?>"
|
||||
<?= !empty($shortcut) ? 'aria-keyshortcuts="' . h($shortcut) . '"' : '' ?>>
|
||||
<span class="theme-switch__icon" aria-hidden="true" data-theme-icon></span>
|
||||
<span data-theme-label></span>
|
||||
<?php if (!empty($shortcut)) : ?>
|
||||
<kbd class="ctrl__key" aria-hidden="true">[<?= h($shortcut) ?>]</kbd>
|
||||
<?php endif; ?>
|
||||
</button>
|
||||
Reference in new issue
Block a user