diff --git a/AGENTS.md b/AGENTS.md
index f52b853..3005a9f 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -68,7 +68,7 @@ src/
YouTubeService YouTube-Links/Timecodes parsen, Watch-/Embed-URLs, Prüfung per oEmbed (Http\Client)
QaService Q&A: Phasen wechseln, Fragen nach Upvotes ranken, Fokus beim Besprechen
templates/ Deutsche UI, Layouts: default, present (Vollbild, dunkel), error, email
-webroot/css/plenario.css Eigenes CSS, kein Framework
+webroot/css/plenario.css Eigenes CSS, kein Framework; Farben nur als Tokens (Hell/Dunkel, siehe Theme unten)
webroot/js/plenario.js Vanilla JS: Polling, Ergebnis-Rendering, Presenter-Steuerung, Folien-Sortierung (Pointer Events + Pfeiltasten)
tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures sind leer
```
@@ -147,6 +147,13 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
7. Tests in `tests/TestCase/Service/VoteServiceTest.php` (Quiz: `QuizTest.php`, Q&A: `QaTest.php`)
8. Nach neuen Spalten lokal `bin/cake cache clear_all`, sonst nutzt das ORM das alte Schema aus dem Cache
+### Farbschema (Tag/Nacht)
+
+`data-theme="light|dark"` auf ``, ohne Attribut gilt die Systemeinstellung. `element/theme_init` setzt die
+Wahl aus `localStorage` vor dem ersten Rendern (Inline-Skript im `
`), `element/theme_switch` ist der Schalter
+(`Theme` in `plenario.js`). Presenter: eigener Schlüssel `plenario-theme-present`, Standard dunkel, Taste T.
+Neue Farben als Token in beiden Dark-Blöcken von `plenario.css` pflegen; auf der Bühne Overlays mit `rgba(var(--tint), …)`.
+
### Live-Updates
Kein WebSocket: Presenter (`/admin/{token}/state`) und Teilnehmende (`/p/{code}/state`) pollen per `fetch`
diff --git a/templates/Admin/present.php b/templates/Admin/present.php
index 7c03ffd..13a6be5 100644
--- a/templates/Admin/present.php
+++ b/templates/Admin/present.php
@@ -3,7 +3,7 @@
* Presenter screen. Rendered empty and filled by webroot/js/plenario.js
* (Plenario.presenter) from /admin/{token}/state.
*
- * Keyboard: ←/→ slides, V voting on/off, H hide results, F fullscreen, Q QR code.
+ * Keyboard: ←/→ slides, V voting on/off, H hide results, F fullscreen, Q QR code, T light/dark.
* Q&A slides: V switches to the next stage; while discussing ←/→ step through the questions first.
*
* @var \App\View\AppView $this
@@ -57,6 +57,12 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl);
= __('Ergebnisse verbergen') ?> [H]
+ = $this->element('theme_switch', [
+ 'key' => 'plenario-theme-present',
+ 'modes' => 'dark,light',
+ 'class' => 'ctrl ctrl--wide',
+ 'shortcut' => 'T',
+ ]) ?>
⛶ = __('Vollbild') ?>
[F]
diff --git a/templates/element/theme_init.php b/templates/element/theme_init.php
new file mode 100644
index 0000000..7a1cfd0
--- /dev/null
+++ b/templates/element/theme_init.php
@@ -0,0 +1,24 @@
+. The theme switch (element theme_switch, webroot/js/plenario.js
+ * `Theme`) writes the same localStorage key.
+ *
+ * @var \App\View\AppView $this
+ * @var string $key localStorage key (presenter uses its own, the beamer is not the laptop)
+ * @var string $fallback Theme without stored choice: '' = follow the system, 'dark' or 'light'
+ */
+$key ??= 'plenario-theme';
+$fallback ??= '';
+?>
+
diff --git a/templates/element/theme_switch.php b/templates/element/theme_switch.php
new file mode 100644
index 0000000..969c927
--- /dev/null
+++ b/templates/element/theme_switch.php
@@ -0,0 +1,25 @@
+
+>
+
+
+
+ [= h($shortcut) ?>]
+
+
diff --git a/templates/layout/default.php b/templates/layout/default.php
index f43e159..15ae39c 100644
--- a/templates/layout/default.php
+++ b/templates/layout/default.php
@@ -16,6 +16,7 @@ $title = $this->fetch('title');
= $title ? h($title) . ' · ' : '' ?>Plenario
+ = $this->element('theme_init') ?>
= $this->Html->meta('icon') ?>
= $this->Html->css(['normalize.min', 'plenario']) ?>
= $this->fetch('meta') ?>
@@ -31,6 +32,7 @@ $title = $this->fetch('title');
= __('Teilnehmen') ?>
= __('Admin-Link verloren?') ?>
+ = $this->element('theme_switch') ?>
diff --git a/templates/layout/error.php b/templates/layout/error.php
index 5eecf82..fa11cf4 100644
--- a/templates/layout/error.php
+++ b/templates/layout/error.php
@@ -12,6 +12,7 @@
= h($this->fetch('title')) ?> · Plenario
+ = $this->element('theme_init') ?>
= $this->Html->meta('icon') ?>
= $this->Html->css(['normalize.min', 'plenario']) ?>
diff --git a/templates/layout/present.php b/templates/layout/present.php
index b06937e..7d3e60a 100644
--- a/templates/layout/present.php
+++ b/templates/layout/present.php
@@ -1,6 +1,6 @@
= h($this->fetch('title')) ?> · Plenario
+ = $this->element('theme_init', ['key' => 'plenario-theme-present', 'fallback' => 'dark']) ?>
= $this->Html->meta('icon') ?>
= $this->Html->css(['normalize.min', 'plenario']) ?>
diff --git a/webroot/css/plenario.css b/webroot/css/plenario.css
index c994186..041f8ca 100644
--- a/webroot/css/plenario.css
+++ b/webroot/css/plenario.css
@@ -28,10 +28,33 @@
--c4: #2f8fe0;
--c5: #8e44c9;
--qa: #1f6bb0; /* Q&A accent, AA contrast with white text */
+ --notice-bg: #fff6e0;
+ --notice-ink: #6b4a00;
+ color-scheme: light;
+}
+
+/*
+ * Theme: data-theme="light|dark" on (set by the theme switch, stored per browser),
+ * without it the system setting decides. Keep both dark blocks in sync.
+ */
+:root[data-theme="dark"] {
+ --bg: #12131d;
+ --surface: #1b1d2b;
+ --surface-2: #24263a;
+ --text: #eceefa;
+ --muted: #a1a6c3;
+ --border: #30334a;
+ --primary: #7f75ff;
+ --primary-soft: #2a2752;
+ --qa: #7cc4ff;
+ --shadow: none;
+ --notice-bg: #3a2f12;
+ --notice-ink: #f3d98f;
+ color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
- :root:not(.present) {
+ :root:not([data-theme="light"]) {
--bg: #12131d;
--surface: #1b1d2b;
--surface-2: #24263a;
@@ -42,6 +65,9 @@
--primary-soft: #2a2752;
--qa: #7cc4ff;
--shadow: none;
+ --notice-bg: #3a2f12;
+ --notice-ink: #f3d98f;
+ color-scheme: dark;
}
}
@@ -156,8 +182,7 @@ h3 { font-size: 1.05rem; margin-top: 1.6em; }
.message.warning { border-color: var(--warn); }
.message.hidden { display: none; }
-.notice { padding: 12px 16px; border-radius: 8px; background: #fff6e0; color: #6b4a00; margin-bottom: 24px; font-size: .95rem; }
-@media (prefers-color-scheme: dark) { .notice { background: #3a2f12; color: #f3d98f; } }
+.notice { padding: 12px 16px; border-radius: 8px; background: var(--notice-bg); color: var(--notice-ink); margin-bottom: 24px; font-size: .95rem; }
.devnote { margin-top: 24px; padding: 16px; border: 2px dashed var(--warn); border-radius: var(--radius); }
.icon-circle { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: var(--primary-soft); color: var(--primary); }
@@ -427,19 +452,34 @@ button.qa-steps__step:hover:not(:disabled) { color: var(--text); border-color: v
.qa-steps .is-current .qa-steps__step { background: var(--qa); border-color: var(--qa); color: var(--surface); font-weight: 700; cursor: default; }
/* ---------------------------------------------------------------- presenter */
+/* Dark by default (beamer); the presenter's own switch can make it light (data-theme="light"). */
body.present {
--bg: #0f1020;
--surface-2: #1f2140;
--text: #f3f4ff;
--muted: #a3a7cf;
- background: radial-gradient(1200px 600px at 10% -10%, #2a1f6e 0%, transparent 60%), var(--bg);
+ --tint: 255, 255, 255; /* overlays on the stage: rgba(var(--tint), alpha) */
+ --stage-glow: #2a1f6e;
+ --stage-ok: #3ddc97; /* brighter green for contrast on the dark stage */
+ --overlay-bg: rgba(8, 9, 20, .92);
+ background: radial-gradient(1200px 600px at 10% -10%, var(--stage-glow) 0%, transparent 60%), var(--bg);
color: var(--text);
overflow: hidden;
}
.stage { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; padding: 20px 4vw; }
+:root[data-theme="light"] body.present {
+ --bg: #f5f6fb;
+ --surface-2: #e4e7f4;
+ --text: #1d1f33;
+ --muted: #4f5473;
+ --tint: 20, 22, 50;
+ --stage-glow: #dcd8ff;
+ --stage-ok: var(--ok);
+ --overlay-bg: rgba(245, 246, 251, .95);
+}
.stage__top { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: clamp(1rem, 1.6vw, 1.4rem); color: var(--muted); }
.stage__top strong { color: var(--text); }
-.stage__code { letter-spacing: .12em; background: rgba(255, 255, 255, .1); padding: 2px 10px; border-radius: 8px; }
+.stage__code { letter-spacing: .12em; background: rgba(var(--tint), .1); padding: 2px 10px; border-radius: 8px; }
.stage__qr { border: 0; padding: 4px; background: #fff; border-radius: 8px; cursor: zoom-in; }
.stage__qr img { display: block; width: 72px; height: 72px; }
.stage__main { display: flex; flex-direction: column; justify-content: center; min-height: 0; overflow: auto; padding: 2vh 0; }
@@ -454,7 +494,7 @@ body.present {
.stage--closed .stage__type::after { content: " · Abstimmung geschlossen"; color: var(--muted); }
.stage .bar__track { height: 1.1em; }
.stage .columns { height: 34vh; }
-.stage .average { padding: 2vh 2.5vw; gap: 2vh 4vw; background: rgba(255, 255, 255, .06); }
+.stage .average { padding: 2vh 2.5vw; gap: 2vh 4vw; background: rgba(var(--tint), .06); }
.stage .average__value strong { font-size: clamp(4rem, 9vw, 8rem); }
.stage .average__of { font-size: clamp(1.6rem, 3vw, 2.8rem); }
.stage .average__label, .stage .average__count, .stage .average__ends { font-size: clamp(.9rem, 1.4vw, 1.3rem); }
@@ -463,15 +503,15 @@ body.present {
.stage .answers { columns: 340px; }
.stage .quiz-timer { font-size: clamp(3rem, 7vw, 6rem); }
.stage .quiz-tile { font-size: clamp(1.2rem, 2.2vw, 2rem); }
-/* brighter green for contrast on the dark stage */
-.stage .quiz-summary strong, .stage .bar--correct .bar__label { color: #3ddc97; }
-.stage .bar--correct .bar__fill { background: #3ddc97; }
+.stage .quiz-summary strong, .stage .bar--correct .bar__label { color: var(--stage-ok); }
+.stage .bar--correct .bar__fill { background: var(--stage-ok); }
.stage .qa-steps { font-size: .7em; }
-.stage .qa-steps__step { border-color: rgba(255, 255, 255, .25); }
-.stage .qa-item { background: rgba(255, 255, 255, .06); }
+.stage .qa-steps__step { border-color: rgba(var(--tint), .25); }
+.stage .qa-item { background: rgba(var(--tint), .06); }
.stage { --qa: #7cc4ff; }
+:root[data-theme="light"] .stage { --qa: #1f6bb0; }
.stage .qa-steps .is-current .qa-steps__step { color: var(--bg); }
-.stage .qa-focus { background: rgba(255, 255, 255, .08); padding: 3vh 3vw; }
+.stage .qa-focus { background: rgba(var(--tint), .08); padding: 3vh 3vw; }
.stage .qa-focus__meta { font-size: .7em; }
.stage .qa-focus__text { font-size: clamp(1.8rem, 3.6vw, 3.2rem); line-height: 1.2; }
.stage .qa-list--compact { font-size: .75em; }
@@ -479,8 +519,8 @@ body.present {
.stage__controls { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; opacity: .35; transition: opacity .2s; padding-top: 12px; }
.stage__controls:hover, .stage__controls:focus-within { opacity: 1; }
-.ctrl { min-width: 44px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06); color: var(--text); font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
-.ctrl:hover { background: rgba(255, 255, 255, .15); }
+.ctrl { min-width: 44px; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(var(--tint), .2); background: rgba(var(--tint), .06); color: var(--text); font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
+.ctrl:hover { background: rgba(var(--tint), .15); }
.ctrl { gap: 6px; }
/* Visible keyboard shortcuts – nobody hovers for tooltips during a talk. */
.ctrl__key { font: inherit; font-size: .8em; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
@@ -492,6 +532,11 @@ body.present {
}
.ctrl-counter { color: var(--muted); min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
-.qr-overlay { position: fixed; inset: 0; background: rgba(8, 9, 20, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; cursor: zoom-out; z-index: 10; }
+.qr-overlay { position: fixed; inset: 0; background: var(--overlay-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; cursor: zoom-out; z-index: 10; }
.qr-overlay img { width: min(70vh, 80vw); height: auto; background: #fff; border-radius: 16px; padding: 16px; }
.qr-overlay p { font-size: 1.4rem; }
+
+/* ---------------------------------------------------------------- theme switch */
+.theme-switch { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
+.theme-switch:hover { border-color: var(--primary); }
+.theme-switch__icon { font-size: 1.05em; line-height: 1; }
diff --git a/webroot/js/plenario.js b/webroot/js/plenario.js
index 2dff7c4..2541d72 100644
--- a/webroot/js/plenario.js
+++ b/webroot/js/plenario.js
@@ -10,6 +10,8 @@
* - [data-countdown] quiz timer (data-remaining = seconds), fires `plenario:timeup` on document
* - [data-quiz-options] slide form: "add answer" button for quiz slides
* - [data-sortable] admin slide list: drag & drop / arrow keys via [data-drag-handle], POSTs ids[] to the URL
+ * - [data-theme-switch] cycles the colour scheme (data-theme on , stored in localStorage),
+ * see templates/element/theme_init.php for the pre-paint part
*
* Results JSON shape: see src/Service/ResultsService.php
*/
@@ -917,11 +919,18 @@
case 'Q':
toggleQr();
break;
+ case 't':
+ case 'T':
+ if (themeSwitch) {
+ themeSwitch.click();
+ }
+ break;
case 'Escape':
overlay.hidden = true;
break;
}
});
+ var themeSwitch = q('[data-theme-switch]');
var poller = poll(refresh, interval);
document.addEventListener('plenario:timeup', function () {
@@ -1523,9 +1532,58 @@
}
}
+ // ------------------------------------------------------------------ theme switch
+
+ var THEME_ICONS = { auto: '◐', light: '☀', dark: '☾' };
+
+ function initThemeSwitch(button) {
+ var key = button.getAttribute('data-theme-key');
+ var modes = button.getAttribute('data-theme-modes').split(',');
+ var root = document.documentElement;
+
+ function current() {
+ var theme = root.getAttribute('data-theme') || 'auto';
+ return modes.indexOf(theme) >= 0 ? theme : modes[0];
+ }
+
+ function label(mode) {
+ return button.getAttribute('data-label-' + mode);
+ }
+
+ function render() {
+ var mode = current();
+ var next = modes[(modes.indexOf(mode) + 1) % modes.length];
+ button.querySelector('[data-theme-icon]').textContent = THEME_ICONS[mode];
+ button.querySelector('[data-theme-label]').textContent = label(mode);
+ var text = button.getAttribute('data-label-prefix') + ': ' + label(mode) + ', '
+ + button.getAttribute('data-label-next') + ' ' + label(next);
+ button.setAttribute('aria-label', text);
+ button.title = text + (button.hasAttribute('aria-keyshortcuts') ? ' (' + button.getAttribute('aria-keyshortcuts') + ')' : '');
+ }
+
+ button.addEventListener('click', function () {
+ var next = modes[(modes.indexOf(current()) + 1) % modes.length];
+ if (next === 'auto') {
+ root.removeAttribute('data-theme');
+ } else {
+ root.setAttribute('data-theme', next);
+ }
+ try {
+ localStorage.setItem(key, next);
+ } catch (e) {
+ // private mode: the choice just lasts until reload
+ }
+ render();
+ });
+
+ render();
+ button.hidden = false;
+ }
+
// ------------------------------------------------------------------ boot
document.addEventListener('DOMContentLoaded', function () {
+ document.querySelectorAll('[data-theme-switch]').forEach(initThemeSwitch);
initCopy();
initShare();
document.querySelectorAll('[data-youtube-form]').forEach(initYouTubeForm);