diff --git a/frontend/scripts/build-tokens.ts b/frontend/scripts/build-tokens.ts index 20bbf5105..59e1f7a29 100644 --- a/frontend/scripts/build-tokens.ts +++ b/frontend/scripts/build-tokens.ts @@ -15,6 +15,7 @@ import { fileURLToPath } from "node:url"; import { colorBrand, colorCanvas, + colorCrt, colorDark, colorLight, colorOverlay, @@ -143,6 +144,7 @@ const SHARED: Entry[] = [ ...entriesFor(colorProvider, "colorProvider", "--r-color-provider"), ...entriesFor(colorOverlay, "colorOverlay", "--r-color-overlay"), ...entriesFor(colorCanvas, "colorCanvas", "--r-color-canvas"), + ...entriesFor(colorCrt, "colorCrt", "--r-color-crt"), ...entriesFor(fontFamily, "fontFamily", "--r-font-family"), ...entriesFor(fontSize, "fontSize", "--r-font-size"), ...entriesFor(lineHeight, "lineHeight", "--r-line-height"), diff --git a/frontend/src/locales/bg_BG/common.json b/frontend/src/locales/bg_BG/common.json index 64c0b72cc..7c1ae02b9 100644 --- a/frontend/src/locales/bg_BG/common.json +++ b/frontend/src/locales/bg_BG/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "Относно", "add": "Добави", "administration": "Администрация", diff --git a/frontend/src/locales/bg_BG/settings.json b/frontend/src/locales/bg_BG/settings.json index 6b75444f6..224103c53 100644 --- a/frontend/src/locales/bg_BG/settings.json +++ b/frontend/src/locales/bg_BG/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Неуспешно зареждане на липсващи ROM-ове: {error}", "deferred": "Отложено", "deleting-mapping": "Изтриване", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Изключи анимациите", "disable-animations-desc": "Изключи всички анимации в галерията (въртящ се CD, зареждане на касета, видео при посочване)", "edit-user": "Редактирай потребител", diff --git a/frontend/src/locales/cs_CZ/common.json b/frontend/src/locales/cs_CZ/common.json index 451b1a958..a23bcd1c6 100644 --- a/frontend/src/locales/cs_CZ/common.json +++ b/frontend/src/locales/cs_CZ/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "O aplikaci", "add": "Přidat", "administration": "Administrace", diff --git a/frontend/src/locales/cs_CZ/settings.json b/frontend/src/locales/cs_CZ/settings.json index 7c0287eb8..abb259aba 100644 --- a/frontend/src/locales/cs_CZ/settings.json +++ b/frontend/src/locales/cs_CZ/settings.json @@ -55,6 +55,7 @@ "couldnt-fetch-missing-roms": "Nelze načíst chybějící ROM: {error}", "deferred": "Odloženo", "deleting-mapping": "Mazání", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Zakázat animace", "disable-animations-desc": "Zakáže všechny animace v galerii (otáčení CD, vkládání cartridge, hover videa)", "edit-user": "Upravit uživatele", diff --git a/frontend/src/locales/de_DE/common.json b/frontend/src/locales/de_DE/common.json index 2fd4de5c5..ad519e826 100644 --- a/frontend/src/locales/de_DE/common.json +++ b/frontend/src/locales/de_DE/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT-Modus", "about": "Über", "add": "Hinzufügen", "administration": "Administration", diff --git a/frontend/src/locales/de_DE/settings.json b/frontend/src/locales/de_DE/settings.json index dfe0ba97e..7d77eae95 100644 --- a/frontend/src/locales/de_DE/settings.json +++ b/frontend/src/locales/de_DE/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Fehlende ROMs konnten nicht abgerufen werden: {error}", "deferred": "Aufgeschoben", "deleting-mapping": "Löschen", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Animationen deaktivieren", "disable-animations-desc": "Alle Animationen in der Galerie deaktivieren (CD-Rotation, Kassettenladen, Hover-Videos)", "edit-user": "Benutzer bearbeiten", diff --git a/frontend/src/locales/en_GB/common.json b/frontend/src/locales/en_GB/common.json index 1cd55b885..ba6ce9325 100644 --- a/frontend/src/locales/en_GB/common.json +++ b/frontend/src/locales/en_GB/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "About", "add": "Add", "administration": "Administration", diff --git a/frontend/src/locales/en_GB/settings.json b/frontend/src/locales/en_GB/settings.json index f42b1565a..5cda869e6 100644 --- a/frontend/src/locales/en_GB/settings.json +++ b/frontend/src/locales/en_GB/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Couldn't fetch missing ROMs: {error}", "deferred": "Deferred", "deleting-mapping": "Deleting", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Disable animations", "disable-animations-desc": "Disable all animations in the gallery (CD spinning, cartridge loading, hover videos)", "edit-user": "Edit user", diff --git a/frontend/src/locales/en_US/common.json b/frontend/src/locales/en_US/common.json index d50405f1e..ad2cce963 100644 --- a/frontend/src/locales/en_US/common.json +++ b/frontend/src/locales/en_US/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "About", "add": "Add", "administration": "Administration", diff --git a/frontend/src/locales/en_US/settings.json b/frontend/src/locales/en_US/settings.json index f9c769fb8..0f57e88f3 100644 --- a/frontend/src/locales/en_US/settings.json +++ b/frontend/src/locales/en_US/settings.json @@ -55,6 +55,7 @@ "couldnt-fetch-missing-roms": "Couldn't fetch missing ROMs: {error}", "deferred": "Deferred", "deleting-mapping": "Deleting", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Disable animations", "disable-animations-desc": "Disable all animations in the gallery (CD spinning, cartridge loading, hover videos)", "edit-user": "Edit user", diff --git a/frontend/src/locales/es_ES/common.json b/frontend/src/locales/es_ES/common.json index 45a085140..8e4c03bc0 100644 --- a/frontend/src/locales/es_ES/common.json +++ b/frontend/src/locales/es_ES/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "Modo CRT", "about": "Acerca de", "add": "Añadir", "administration": "Administración", diff --git a/frontend/src/locales/es_ES/settings.json b/frontend/src/locales/es_ES/settings.json index 48329898e..2871104c5 100644 --- a/frontend/src/locales/es_ES/settings.json +++ b/frontend/src/locales/es_ES/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "No se pudieron obtener las ROM faltantes: {error}", "deferred": "Diferido", "deleting-mapping": "Eliminando", + "crt-mode-desc": "Dale a la interfaz un aspecto retro de tubo de rayos catódicos con líneas de escaneo, brillo y parpadeo", "disable-animations": "Desactivar animaciones", "disable-animations-desc": "Desactivar todas las animaciones en la galería (rotación de CD, carga de cartuchos, videos al pasar el ratón)", "edit-user": "Editar usuario", diff --git a/frontend/src/locales/fr_FR/common.json b/frontend/src/locales/fr_FR/common.json index e6de31eb4..67ab51017 100644 --- a/frontend/src/locales/fr_FR/common.json +++ b/frontend/src/locales/fr_FR/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "Mode CRT", "about": "À propos", "add": "Ajouter", "administration": "Administration", diff --git a/frontend/src/locales/fr_FR/settings.json b/frontend/src/locales/fr_FR/settings.json index 9348125ad..af2ed2c46 100644 --- a/frontend/src/locales/fr_FR/settings.json +++ b/frontend/src/locales/fr_FR/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Impossible de récupérer les ROM manquantes : {error}", "deferred": "Différé", "deleting-mapping": "Suppression", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Désactiver les animations", "disable-animations-desc": "Désactiver toutes les animations dans la galerie (rotation de CD, chargement de cartouche, vidéos au survol)", "edit-user": "Modifier l'utilisateur", diff --git a/frontend/src/locales/hu_HU/common.json b/frontend/src/locales/hu_HU/common.json index 8720c65ad..8b98ca77f 100644 --- a/frontend/src/locales/hu_HU/common.json +++ b/frontend/src/locales/hu_HU/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "Rólunk", "add": "Hozzáadás", "administration": "Adminisztráció", diff --git a/frontend/src/locales/hu_HU/settings.json b/frontend/src/locales/hu_HU/settings.json index 1993bae95..e404b627a 100644 --- a/frontend/src/locales/hu_HU/settings.json +++ b/frontend/src/locales/hu_HU/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "A hiányzó ROM-ok lekérése sikertelen: {error}", "deferred": "Hivatkozás megszüntetve", "deleting-mapping": "Törlés", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Animációk letiltása", "disable-animations-desc": "Kapcsolja ki az összes animációt a galériában (CD forgatás, kazetta betöltés, lebegő videók)", "edit-user": "Felhasználó szerkesztése", diff --git a/frontend/src/locales/it_IT/common.json b/frontend/src/locales/it_IT/common.json index 807467dec..400d78914 100644 --- a/frontend/src/locales/it_IT/common.json +++ b/frontend/src/locales/it_IT/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "Modalità CRT", "about": "Informazioni", "add": "Aggiungi", "administration": "Amministrazione", diff --git a/frontend/src/locales/it_IT/settings.json b/frontend/src/locales/it_IT/settings.json index a58a1ae19..404ee99d8 100644 --- a/frontend/src/locales/it_IT/settings.json +++ b/frontend/src/locales/it_IT/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Impossibile recuperare le ROM mancanti: {error}", "deferred": "Rimandato", "deleting-mapping": "Eliminazione", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Disabilita animazioni", "disable-animations-desc": "Disabilita tutte le animazioni nella galleria (rotazione CD, caricamento cartucce, video al passaggio del mouse)", "edit-user": "Modifica utente", diff --git a/frontend/src/locales/ja_JP/common.json b/frontend/src/locales/ja_JP/common.json index 5eef223be..98d3d51d2 100644 --- a/frontend/src/locales/ja_JP/common.json +++ b/frontend/src/locales/ja_JP/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "概要", "add": "追加", "administration": "管理者メニュー", diff --git a/frontend/src/locales/ja_JP/settings.json b/frontend/src/locales/ja_JP/settings.json index a14505d92..4025fb8a9 100644 --- a/frontend/src/locales/ja_JP/settings.json +++ b/frontend/src/locales/ja_JP/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "不足しているROMを取得できませんでした: {error}", "deferred": "延期済み", "deleting-mapping": "削除中", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "アニメーションを無効化", "disable-animations-desc": "ギャラリー内のすべてのアニメーションを無効化(CD回転、カートリッジ読み込み、ホバービデオ)", "edit-user": "ユーザーを編集", diff --git a/frontend/src/locales/ko_KR/common.json b/frontend/src/locales/ko_KR/common.json index 165eb173c..9f8c4d4a2 100644 --- a/frontend/src/locales/ko_KR/common.json +++ b/frontend/src/locales/ko_KR/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "정보", "add": "추가", "administration": "유저 관리", diff --git a/frontend/src/locales/ko_KR/settings.json b/frontend/src/locales/ko_KR/settings.json index c47e07807..ebcb5fcb9 100644 --- a/frontend/src/locales/ko_KR/settings.json +++ b/frontend/src/locales/ko_KR/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "누락된 ROM을 가져오지 못했습니다: {error}", "deferred": "연기됨", "deleting-mapping": "삭제 중", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "애니메이션 비활성화", "disable-animations-desc": "갤러리의 모든 애니메이션 비활성화 (CD 회전, 카트리지 로딩, 호버 비디오)", "edit-user": "사용자 편집", diff --git a/frontend/src/locales/pl_PL/common.json b/frontend/src/locales/pl_PL/common.json index 9dfce1b06..4404321a1 100644 --- a/frontend/src/locales/pl_PL/common.json +++ b/frontend/src/locales/pl_PL/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "O aplikacji", "add": "Dodaj", "administration": "Administracja", diff --git a/frontend/src/locales/pl_PL/settings.json b/frontend/src/locales/pl_PL/settings.json index e0ff1333f..57a5eb805 100644 --- a/frontend/src/locales/pl_PL/settings.json +++ b/frontend/src/locales/pl_PL/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Nie udało się pobrać brakujących ROM-ów: {error}", "deferred": "Odroczono", "deleting-mapping": "Usuwanie", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Wyłącz animacje", "disable-animations-desc": "Wyłącz wszystkie animacje w galerii (obracanie CD, ładowanie kartridży, wideo po najechaniu)", "edit-user": "Edytuj użytkownika", diff --git a/frontend/src/locales/pt_BR/common.json b/frontend/src/locales/pt_BR/common.json index ed6d92c17..bbfb29676 100644 --- a/frontend/src/locales/pt_BR/common.json +++ b/frontend/src/locales/pt_BR/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "Modo CRT", "about": "Sobre", "add": "Adicionar", "administration": "Administração", diff --git a/frontend/src/locales/pt_BR/settings.json b/frontend/src/locales/pt_BR/settings.json index f0b80db11..bd9305d7e 100644 --- a/frontend/src/locales/pt_BR/settings.json +++ b/frontend/src/locales/pt_BR/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Não foi possível obter as ROMs ausentes: {error}", "deferred": "Adiado", "deleting-mapping": "Excluindo", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Desativar animações", "disable-animations-desc": "Desativar todas as animações na galeria (rotação de CD, carregamento de cartuchos, vídeos ao passar o mouse)", "edit-user": "Editar usuário", diff --git a/frontend/src/locales/ro_RO/common.json b/frontend/src/locales/ro_RO/common.json index ae4dec422..caaae22ad 100644 --- a/frontend/src/locales/ro_RO/common.json +++ b/frontend/src/locales/ro_RO/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "Despre", "add": "Adaugă", "administration": "Administrare", diff --git a/frontend/src/locales/ro_RO/settings.json b/frontend/src/locales/ro_RO/settings.json index 394122861..d3f57da02 100644 --- a/frontend/src/locales/ro_RO/settings.json +++ b/frontend/src/locales/ro_RO/settings.json @@ -55,6 +55,7 @@ "couldnt-fetch-missing-roms": "Nu s-au putut prelua ROM-urile lipsă: {error}", "deferred": "Amânat", "deleting-mapping": "Ștergere", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Dezactivează animațiile", "disable-animations-desc": "Dezactivează toate animațiile din galerie (rotirea CD-ului, încărcarea cartușului, videoclipurile la trecerea mouse-ului)", "edit-user": "Editează utilizatorul", diff --git a/frontend/src/locales/ru_RU/common.json b/frontend/src/locales/ru_RU/common.json index fadfb803e..64aaab0b0 100644 --- a/frontend/src/locales/ru_RU/common.json +++ b/frontend/src/locales/ru_RU/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "О приложении", "add": "Добавить", "administration": "Администрирование", diff --git a/frontend/src/locales/ru_RU/settings.json b/frontend/src/locales/ru_RU/settings.json index c37e6aaab..7c3abc024 100644 --- a/frontend/src/locales/ru_RU/settings.json +++ b/frontend/src/locales/ru_RU/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "Не удалось получить отсутствующие ROM: {error}", "deferred": "Отложено", "deleting-mapping": "Удаление", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "Отключить анимации", "disable-animations-desc": "Отключить все анимации в галерее (вращение CD, загрузка картриджей, видео при наведении)", "edit-user": "Редактировать пользователя", diff --git a/frontend/src/locales/zh_CN/common.json b/frontend/src/locales/zh_CN/common.json index 139cf0258..57eb3abe9 100644 --- a/frontend/src/locales/zh_CN/common.json +++ b/frontend/src/locales/zh_CN/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "关于", "add": "添加", "administration": "管理", diff --git a/frontend/src/locales/zh_CN/settings.json b/frontend/src/locales/zh_CN/settings.json index c5852c3ae..e16380f78 100644 --- a/frontend/src/locales/zh_CN/settings.json +++ b/frontend/src/locales/zh_CN/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "无法获取缺失的 ROM:{error}", "deferred": "已延期", "deleting-mapping": "删除中", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "禁用动画", "disable-animations-desc": "禁用游戏库中的所有动画(CD 旋转、卡带加载、悬停视频)", "edit-user": "编辑用户", diff --git a/frontend/src/locales/zh_TW/common.json b/frontend/src/locales/zh_TW/common.json index 14478ba8e..00ad4fe4f 100644 --- a/frontend/src/locales/zh_TW/common.json +++ b/frontend/src/locales/zh_TW/common.json @@ -1,4 +1,5 @@ { + "crt-mode": "CRT mode", "about": "關於", "add": "新增", "administration": "管理系統", diff --git a/frontend/src/locales/zh_TW/settings.json b/frontend/src/locales/zh_TW/settings.json index b106d1a5e..a7bef598a 100644 --- a/frontend/src/locales/zh_TW/settings.json +++ b/frontend/src/locales/zh_TW/settings.json @@ -46,6 +46,7 @@ "couldnt-fetch-missing-roms": "無法取得缺少的 ROM:{error}", "deferred": "已延期", "deleting-mapping": "刪除中", + "crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker", "disable-animations": "停用動畫", "disable-animations-desc": "停用遊戲庫中的所有動畫(CD 旋轉、卡帶載入、懸停影片)", "edit-user": "編輯用戶", diff --git a/frontend/src/v2/components/AppShell/CrtOverlay.vue b/frontend/src/v2/components/AppShell/CrtOverlay.vue new file mode 100644 index 000000000..1764f9691 --- /dev/null +++ b/frontend/src/v2/components/AppShell/CrtOverlay.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/frontend/src/v2/components/AppShell/CrtWarmup.vue b/frontend/src/v2/components/AppShell/CrtWarmup.vue new file mode 100644 index 000000000..e4d29717f --- /dev/null +++ b/frontend/src/v2/components/AppShell/CrtWarmup.vue @@ -0,0 +1,329 @@ + + + + + diff --git a/frontend/src/v2/composables/useCrtMode/index.test.ts b/frontend/src/v2/composables/useCrtMode/index.test.ts new file mode 100644 index 000000000..ab1cf8e55 --- /dev/null +++ b/frontend/src/v2/composables/useCrtMode/index.test.ts @@ -0,0 +1,68 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { nextTick } from "vue"; + +const KEY = "settings.v2.crtMode"; + +// `enabled` is a module-level singleton created at import time, so it reads +// localStorage exactly once on load. Re-import the module fresh after seeding +// storage to exercise the default / persisted-read paths in isolation. +async function loadFresh() { + vi.resetModules(); + const { useCrtMode } = await import("./index"); + return useCrtMode(); +} + +beforeEach(() => { + localStorage.clear(); +}); + +afterEach(() => { + localStorage.clear(); +}); + +describe("useCrtMode", () => { + it("defaults to off when nothing is persisted", async () => { + const { enabled } = await loadFresh(); + expect(enabled.value).toBe(false); + }); + + it("restores a previously persisted value on load", async () => { + localStorage.setItem(KEY, "true"); + const { enabled } = await loadFresh(); + expect(enabled.value).toBe(true); + }); + + it("persists changes under the 'settings.v2.crtMode' key", async () => { + const { enabled } = await loadFresh(); + enabled.value = true; + await nextTick(); + expect(localStorage.getItem(KEY)).toBe("true"); + }); + + it("toggle() flips the state and returns the new value", async () => { + const { enabled, toggle } = await loadFresh(); + expect(enabled.value).toBe(false); + + expect(toggle()).toBe(true); + expect(enabled.value).toBe(true); + + expect(toggle()).toBe(false); + expect(enabled.value).toBe(false); + }); + + it("toggle() writes through to localStorage", async () => { + const { toggle } = await loadFresh(); + toggle(); + await nextTick(); + expect(localStorage.getItem(KEY)).toBe("true"); + }); + + it("shares a single instance across calls within a load", async () => { + vi.resetModules(); + const { useCrtMode } = await import("./index"); + const a = useCrtMode(); + const b = useCrtMode(); + a.toggle(); + expect(b.enabled.value).toBe(true); + }); +}); diff --git a/frontend/src/v2/composables/useCrtMode/index.ts b/frontend/src/v2/composables/useCrtMode/index.ts new file mode 100644 index 000000000..1bf452782 --- /dev/null +++ b/frontend/src/v2/composables/useCrtMode/index.ts @@ -0,0 +1,25 @@ +// useCrtMode — singleton toggle for the cosmetic "CRT mode" shader. +// +// CRT mode is a purely visual easter egg: when on, a persistent full-screen +// scanline / vignette / flicker / glitch overlay (CrtOverlay.vue) makes RomM +// look like it is running on an old cathode-ray tube, and toggling it ON +// fires the one-shot power-on warm-up flash (CrtWarmup.vue). +// +// State is persisted in localStorage and shared across components through a +// single module-level ref — same rationale as `useUiVersion`: vueuse's +// useLocalStorage creates an independent ref per call (shared storage, not +// shared reactivity within a tab), so we create it once here and everyone +// imports the same instance. +import { useLocalStorage } from "@vueuse/core"; + +const enabled = useLocalStorage("settings.v2.crtMode", false); + +export function useCrtMode() { + /** Flip CRT mode and return the new state (true = now on). */ + function toggle(): boolean { + enabled.value = !enabled.value; + return enabled.value; + } + + return { enabled, toggle }; +} diff --git a/frontend/src/v2/layouts/AppLayout.vue b/frontend/src/v2/layouts/AppLayout.vue index 47a49b0d0..6e4c3c1a4 100644 --- a/frontend/src/v2/layouts/AppLayout.vue +++ b/frontend/src/v2/layouts/AppLayout.vue @@ -17,6 +17,7 @@ import AppNav from "@/v2/components/AppShell/AppNav.vue"; import BackgroundArt from "@/v2/components/AppShell/BackgroundArt.vue"; import BottomNav from "@/v2/components/AppShell/BottomNav.vue"; import BreakpointBadge from "@/v2/components/AppShell/BreakpointBadge.vue"; +import CrtOverlay from "@/v2/components/AppShell/CrtOverlay.vue"; import GlobalDialogs from "@/v2/components/Dialogs/GlobalDialogs.vue"; import SoundtrackMiniPlayer from "@/v2/components/Soundtrack/MiniPlayer.vue"; import { BACKGROUND_ART_KEY } from "@/v2/composables/useBackgroundArt"; @@ -143,6 +144,7 @@ onBeforeUnmount(() => { + diff --git a/frontend/src/v2/styles/tokens.css b/frontend/src/v2/styles/tokens.css index 012d5a669..8084bb058 100644 --- a/frontend/src/v2/styles/tokens.css +++ b/frontend/src/v2/styles/tokens.css @@ -62,6 +62,9 @@ --r-color-overlay-emphasis-fg: #111117; --r-color-canvas-bg: #000000; --r-color-canvas-bg-deep: #0d1117; + --r-color-crt-glow: #7dffb4; + --r-color-crt-ghost-warm: #ff3b5c; + --r-color-crt-ghost-cool: #3bd9ff; --r-font-family-sans: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, "Inter", Roboto, sans-serif; diff --git a/frontend/src/v2/tokens/index.ts b/frontend/src/v2/tokens/index.ts index 60a5eb924..079f1cd31 100644 --- a/frontend/src/v2/tokens/index.ts +++ b/frontend/src/v2/tokens/index.ts @@ -173,6 +173,20 @@ export const colorCanvas = { bgDeep: "#0d1117", } as const; +// CRT gimmick — the cosmetic "CRT mode" shader + power-on warm-up flash +// (see CrtOverlay.vue / CrtWarmup.vue, toggled from Settings → User Interface → Theme). +// Theme-agnostic by design: the phosphor green and the red/cyan chromatic-aberration ghosts +// read the same on dark and light, so they live in SHARED rather than the +// per-theme palettes. Consumed only as CSS vars (--r-color-crt-*), always at +// low opacity via color-mix. +export const colorCrt = { + // Phosphor afterglow / glow tint (P1 green). + glow: "#7dffb4", + // Chromatic-aberration ghosts for the RGB-split glitch. + ghostWarm: "#ff3b5c", + ghostCool: "#3bd9ff", +} as const; + // Procedural cover-art palette — the fixed colours of the generated // "no cover" artwork (missing / unmatched placeholders). Baked into an // SVG string by `utils/covers`, so they live here as the single home for diff --git a/frontend/src/v2/views/Settings/UserInterface.vue b/frontend/src/v2/views/Settings/UserInterface.vue index 5a3a49630..deb6158ad 100644 --- a/frontend/src/v2/views/Settings/UserInterface.vue +++ b/frontend/src/v2/views/Settings/UserInterface.vue @@ -13,16 +13,18 @@ // `useUISettings` still exposes `platformsGroupBy` for v1 — we just // don't surface it here. import { RIcon, RSelect, RSliderBtnGroup, RChip } from "@v2/lib"; -import { computed } from "vue"; +import { computed, ref } from "vue"; import { useI18n } from "vue-i18n"; import { useUISettings } from "@/composables/useUISettings"; import { useUiVersion } from "@/composables/useUiVersion"; import storeCollections from "@/stores/collections"; +import CrtWarmup from "@/v2/components/AppShell/CrtWarmup.vue"; import WidgetReorderList from "@/v2/components/Home/Widgets/WidgetReorderList.vue"; import SettingsSection from "@/v2/components/Settings/SettingsSection.vue"; import SettingsSubsection from "@/v2/components/Settings/SettingsSubsection.vue"; import SettingsToggleRow from "@/v2/components/Settings/SettingsToggleRow.vue"; import LanguageSelector from "@/v2/components/shared/LanguageSelector.vue"; +import { useCrtMode } from "@/v2/composables/useCrtMode"; const { t } = useI18n(); const uiVersion = useUiVersion(); @@ -77,6 +79,15 @@ function setTheme(value: Theme) { selectedTheme.value = value; } +// Cosmetic easter egg — toggle the persistent "CRT mode" shader; switching +// it ON also fires the one-shot power-on warm-up flash. +const { enabled: crtEnabled } = useCrtMode(); +const crtWarmup = ref | null>(null); +function onCrtToggle(value: boolean) { + crtEnabled.value = value; + if (value) crtWarmup.value?.play(); +} + function setVersion(value: "v1" | "v2") { uiVersion.value = value; } @@ -162,6 +173,16 @@ function onVirtualCollectionTypeChange(value: unknown) { {{ opt.label }} +
+ +
+ @@ -401,6 +426,11 @@ function onVirtualCollectionTypeChange(value: unknown) { .r-v2-ui__toggle-grid--single { grid-template-columns: 1fr; } +/* Separate a toggle grid from the control row above it (e.g. the CRT + toggle sitting under the theme picker) with a hairline divider. */ +.r-v2-ui__toggle-grid--bordered { + border-top: 1px solid var(--r-color-border); +} html[data-bp~="xs"] .r-v2-ui__toggle-grid { grid-template-columns: 1fr; }