Skip to content

Commit 13ec267

Browse files
committed
refactor(theme): remove light-safe mode
1 parent 4305d2f commit 13ec267

3 files changed

Lines changed: 2 additions & 50 deletions

File tree

‎apps/web/src/components/debug/RuntimeDebugOverlay.vue‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
</div>
1616
<div class="grid">
1717
<div><span class="label">Theme</span>{{ themeStore.themeSlug }} ({{ themeStore.resolvedMode }})</div>
18-
<div><span class="label">LightSafe</span>{{ lightSafe }}</div>
1918
<div><span class="label">API</span>{{ apiBaseUrl }}</div>
2019
<div><span class="label">URL</span>{{ href }}</div>
2120
</div>
@@ -39,11 +38,6 @@ const href = computed(() => {
3938
return window.location.href
4039
})
4140
42-
const lightSafe = computed(() => {
43-
if (typeof document === 'undefined') return 'n/a'
44-
return document.documentElement.getAttribute('data-light-safe') === '1' ? '1' : '0'
45-
})
46-
4741
const pillText = computed(() => {
4842
const parts: string[] = []
4943
if (isDebugEnabled('theme')) parts.push('theme')
@@ -58,7 +52,6 @@ async function copyDiagnostics() {
5852
theme: themeStore.themeSlug,
5953
colorMode: themeStore.colorMode,
6054
resolvedMode: themeStore.resolvedMode,
61-
lightSafe: lightSafe.value,
6255
bodyClass: typeof document === 'undefined' ? '' : document.body.className,
6356
htmlClass: typeof document === 'undefined' ? '' : document.documentElement.className,
6457
}

‎apps/web/src/components/ui/AnimatedTerminal.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const props = withDefaults(defineProps<Props>(), {
2626
});
2727
2828
const themeStore = useThemeStore();
29-
const isCalmLightMode = computed(() => themeStore.isLightSafe);
29+
const isCalmLightMode = computed(() => !themeStore.isDark);
3030
3131
// Alien terminal characters
3232
const ALIEN_CHARS = '░▒▓█◢◣◤◥⬡⬢╔╗╚╝═║▲▼◀▶◉◎●⟨⟩⟪⟫⌬⌭⌮∆∇⊕⊖⊗λΣΩπ∞≋≈01';

‎apps/web/src/stores/theme.ts‎

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,6 @@ import { getApiBaseUrl } from '@/utils/apiUrl'
2020
const STORAGE_KEY = 'synthstack-theme'
2121
const API_BASE = getApiBaseUrl()
2222

23-
// Light mode "safe" mode is enabled for presets that use light backgrounds and
24-
// have been observed to flicker in Chrome; a few "flashy" presets are excluded.
25-
const LIGHT_MODE_FLASHY_PRESETS = new Set(['brutalist', 'cyberpunk', 'terminal'])
26-
27-
type LightSafeOverride = 'force' | 'disable' | null
28-
29-
function getLightSafeOverride(): LightSafeOverride {
30-
if (typeof window === 'undefined') return null
31-
try {
32-
const params = new URLSearchParams(window.location.search)
33-
const value = params.get('lightSafe')
34-
if (value === null) return null
35-
36-
const normalized = value.trim().toLowerCase()
37-
if (normalized === '' || ['1', 'true', 'on', 'yes'].includes(normalized)) return 'force'
38-
if (['0', 'false', 'off', 'no'].includes(normalized)) return 'disable'
39-
return 'force'
40-
} catch {
41-
return null
42-
}
43-
}
44-
4523
const THEME_DEBUG_SELECTORS: Record<string, string> = {
4624
app: '#q-app',
4725
layout: '.q-layout',
@@ -282,17 +260,6 @@ export const useThemeStore = defineStore('theme', () => {
282260
/** Whether dark mode is active */
283261
const isDark = computed(() => resolvedMode.value === 'dark')
284262

285-
/** Whether the landing page light-safe mode is enabled */
286-
const isLightSafe = computed(() => {
287-
if (resolvedMode.value !== 'light') return false
288-
289-
const override = getLightSafeOverride()
290-
if (override === 'force') return true
291-
if (override === 'disable') return false
292-
293-
return !LIGHT_MODE_FLASHY_PRESETS.has(currentPresetSlug.value)
294-
})
295-
296263
/** Current theme slug (alias for preset slug) */
297264
const themeSlug = computed(() => currentPresetSlug.value)
298265

@@ -552,7 +519,6 @@ export const useThemeStore = defineStore('theme', () => {
552519
const isDarkMode = resolvedMode.value === 'dark'
553520
const expectedPreset = preset.slug
554521
const expectedMode = isDarkMode ? 'dark' : 'light'
555-
const expectedLightSafe = isLightSafe.value
556522

557523
// Avoid redundant re-application when the DOM already matches the desired state.
558524
const bodyOk =
@@ -562,8 +528,7 @@ export const useThemeStore = defineStore('theme', () => {
562528
root.classList.contains('dark') === isDarkMode &&
563529
root.classList.contains('light') === !isDarkMode &&
564530
root.getAttribute('data-preset') === expectedPreset &&
565-
root.getAttribute('data-theme') === expectedPreset &&
566-
(expectedLightSafe ? root.getAttribute('data-light-safe') === '1' : !root.hasAttribute('data-light-safe'))
531+
root.getAttribute('data-theme') === expectedPreset
567532

568533
if (bodyOk && rootOk) {
569534
if (isDebugEnabled('theme')) {
@@ -602,11 +567,6 @@ export const useThemeStore = defineStore('theme', () => {
602567
root.setAttribute('data-theme', preset.slug)
603568
root.setAttribute('data-preset', preset.slug)
604569

605-
// Light mode "safe" mode flag (used for CSS guardrails on landing page)
606-
const lightSafe = isLightSafe.value
607-
if (lightSafe) root.setAttribute('data-light-safe', '1')
608-
else root.removeAttribute('data-light-safe')
609-
610570
// Generate and apply CSS variables
611571
const vars = generateCSSVariables(preset, isDarkMode)
612572
Object.entries(vars).forEach(([key, value]) => {
@@ -807,7 +767,6 @@ export const useThemeStore = defineStore('theme', () => {
807767
currentTheme,
808768
colorMode,
809769
resolvedMode,
810-
isLightSafe,
811770
presets,
812771
customThemes,
813772
settings,

0 commit comments

Comments
 (0)