feat: add comic/doodle theme style (#603)
* feat: add comic/doodle theme style with local font Add a new "comic" theme style that applies hand-drawn aesthetics (Comic Neue font, bold borders, heavy font weight) while keeping the original light/dark background colors. Font files are bundled locally to avoid Google Fonts CDN dependency. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix: update DisplaySettings to use renamed theme API and update brand assets Rename mode/setMode/ThemeMode to brightness/setBrightness/BrightnessMode to match the refactored useTheme composable. Update favicon and logo. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.8 MiB |
@@ -10,14 +10,14 @@ import { useKeyboard } from '@/composables/useKeyboard'
|
||||
import { useAppStore } from '@/stores/hermes/app'
|
||||
import SessionSearchModal from '@/components/hermes/chat/SessionSearchModal.vue'
|
||||
|
||||
const { isDark } = useTheme()
|
||||
const { isDark, isComic } = useTheme()
|
||||
const { t } = useI18n()
|
||||
const appStore = useAppStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const ready = ref(false)
|
||||
|
||||
const themeOverrides = computed(() => getThemeOverrides(isDark.value))
|
||||
const themeOverrides = computed(() => getThemeOverrides(isDark.value, isComic.value))
|
||||
const naiveTheme = computed(() => isDark.value ? darkTheme : null)
|
||||
|
||||
const isLoginPage = computed(() => route.name === 'login')
|
||||
|
||||
@@ -46,7 +46,6 @@ async function handleRefresh() {
|
||||
|
||||
.file-toolbar {
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
|
||||
@media (max-width: $breakpoint-mobile) {
|
||||
padding: 8px 4px;
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
import { NSwitch, NSelect, useMessage } from 'naive-ui'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useSettingsStore } from '@/stores/hermes/settings'
|
||||
import { useTheme, type ThemeMode } from '@/composables/useTheme'
|
||||
import { useTheme, type BrightnessMode } from '@/composables/useTheme'
|
||||
import SettingRow from './SettingRow.vue'
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
const { mode, setMode } = useTheme()
|
||||
const { brightness, setBrightness } = useTheme()
|
||||
|
||||
const themeOptions = [
|
||||
{ label: t('settings.display.themeLight'), value: 'light' },
|
||||
@@ -26,8 +26,8 @@ async function save(values: Record<string, any>) {
|
||||
}
|
||||
|
||||
function handleThemeChange(val: string) {
|
||||
const m = val as ThemeMode
|
||||
setMode(m)
|
||||
const m = val as BrightnessMode
|
||||
setBrightness(m)
|
||||
save({ skin: m })
|
||||
}
|
||||
</script>
|
||||
@@ -35,7 +35,7 @@ function handleThemeChange(val: string) {
|
||||
<template>
|
||||
<section class="settings-section">
|
||||
<SettingRow :label="t('settings.display.theme')" :hint="t('settings.display.themeHint')">
|
||||
<NSelect :value="mode" :options="themeOptions" size="small" :consistent-menu-width="false" class="input-sm" @update:value="handleThemeChange" />
|
||||
<NSelect :value="brightness" :options="themeOptions" size="small" :consistent-menu-width="false" class="input-sm" @update:value="handleThemeChange" />
|
||||
</SettingRow>
|
||||
<SettingRow :label="t('settings.display.streaming')" :hint="t('settings.display.streamingHint')">
|
||||
<NSwitch :value="settingsStore.display.streaming" @update:value="v => save({ streaming: v })" />
|
||||
|
||||
@@ -1,28 +1,40 @@
|
||||
<script setup lang="ts">
|
||||
import { useTheme } from '@/composables/useTheme'
|
||||
|
||||
const { isDark, toggleTheme } = useTheme()
|
||||
const { isDark, isComic, toggleBrightness, toggleStyle } = useTheme()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button class="theme-switch" :title="isDark ? 'Light mode' : 'Dark mode'" @click="toggleTheme">
|
||||
<!-- Sun icon (shown in dark mode) -->
|
||||
<svg v-if="isDark" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="5" />
|
||||
<line x1="12" y1="1" x2="12" y2="3" />
|
||||
<line x1="12" y1="21" x2="12" y2="23" />
|
||||
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
|
||||
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
|
||||
<line x1="1" y1="12" x2="3" y2="12" />
|
||||
<line x1="21" y1="12" x2="23" y2="12" />
|
||||
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
|
||||
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
|
||||
</svg>
|
||||
<!-- Moon icon (shown in light mode) -->
|
||||
<svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
||||
</svg>
|
||||
</button>
|
||||
<div style="display: flex; gap: 4px; align-items: center;">
|
||||
<button class="theme-switch" :title="isComic ? 'Ink style' : 'Comic style'" @click="toggleStyle">
|
||||
<!-- Palette icon for comic toggle -->
|
||||
<svg v-if="isComic" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z" />
|
||||
</svg>
|
||||
<!-- Sparkle icon for ink mode -->
|
||||
<svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z" />
|
||||
</svg>
|
||||
</button>
|
||||
<button class="theme-switch" :title="isDark ? 'Light mode' : 'Dark mode'" @click="toggleBrightness">
|
||||
<!-- Sun icon (shown in dark mode) -->
|
||||
<svg v-if="isDark" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="5" />
|
||||
<line x1="12" y1="1" x2="12" y2="3" />
|
||||
<line x1="12" y1="21" x2="12" y2="23" />
|
||||
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
|
||||
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
|
||||
<line x1="1" y1="12" x2="3" y2="12" />
|
||||
<line x1="21" y1="12" x2="23" y2="12" />
|
||||
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
|
||||
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
|
||||
</svg>
|
||||
<!-- Moon icon (shown in light mode) -->
|
||||
<svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -1,57 +1,89 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { ref, watch, computed } from 'vue'
|
||||
|
||||
export type ThemeMode = 'light' | 'dark' | 'system'
|
||||
export type BrightnessMode = 'light' | 'dark' | 'system'
|
||||
export type ThemeStyle = 'ink' | 'comic'
|
||||
|
||||
const STORAGE_KEY = 'hermes_theme'
|
||||
const BRIGHTNESS_KEY = 'hermes_brightness'
|
||||
const STYLE_KEY = 'hermes_style'
|
||||
|
||||
const mode = ref<ThemeMode>(
|
||||
(localStorage.getItem(STORAGE_KEY) as ThemeMode) || 'system',
|
||||
const brightness = ref<BrightnessMode>(
|
||||
(localStorage.getItem(BRIGHTNESS_KEY) as BrightnessMode) || 'system',
|
||||
)
|
||||
|
||||
const style = ref<ThemeStyle>(
|
||||
(localStorage.getItem(STYLE_KEY) as ThemeStyle) || 'ink',
|
||||
)
|
||||
|
||||
const isDark = ref(false)
|
||||
const isComic = ref(false)
|
||||
|
||||
function applyTheme(dark: boolean) {
|
||||
isDark.value = dark
|
||||
document.documentElement.classList.toggle('dark', dark)
|
||||
}
|
||||
|
||||
function resolveDark(m: ThemeMode): boolean {
|
||||
if (m === 'system') {
|
||||
function resolveDark(b: BrightnessMode): boolean {
|
||||
if (b === 'system') {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
}
|
||||
return m === 'dark'
|
||||
return b === 'dark'
|
||||
}
|
||||
|
||||
// Initial resolve
|
||||
applyTheme(resolveDark(mode.value))
|
||||
function applyClasses() {
|
||||
const dark = resolveDark(brightness.value)
|
||||
isDark.value = dark
|
||||
isComic.value = style.value === 'comic'
|
||||
document.documentElement.classList.toggle('dark', dark)
|
||||
document.documentElement.classList.toggle('comic', isComic.value)
|
||||
}
|
||||
|
||||
// Initial
|
||||
applyClasses()
|
||||
|
||||
// Listen for system preference changes
|
||||
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
mediaQuery.addEventListener('change', () => {
|
||||
if (mode.value === 'system') {
|
||||
applyTheme(resolveDark('system'))
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
||||
if (brightness.value === 'system') {
|
||||
applyClasses()
|
||||
}
|
||||
})
|
||||
|
||||
// Watch mode changes
|
||||
watch(mode, (newMode) => {
|
||||
localStorage.setItem(STORAGE_KEY, newMode)
|
||||
applyTheme(resolveDark(newMode))
|
||||
// Persist & apply on change
|
||||
watch(brightness, (b) => {
|
||||
localStorage.setItem(BRIGHTNESS_KEY, b)
|
||||
applyClasses()
|
||||
})
|
||||
|
||||
watch(style, (s) => {
|
||||
localStorage.setItem(STYLE_KEY, s)
|
||||
applyClasses()
|
||||
})
|
||||
|
||||
export function useTheme() {
|
||||
function setMode(m: ThemeMode) {
|
||||
mode.value = m
|
||||
const themeName = computed(() => {
|
||||
const b = isDark.value ? 'dark' : 'light'
|
||||
return isComic.value ? `comic-${b}` : b
|
||||
})
|
||||
|
||||
function setBrightness(b: BrightnessMode) {
|
||||
brightness.value = b
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
mode.value = isDark.value ? 'light' : 'dark'
|
||||
function setStyle(s: ThemeStyle) {
|
||||
style.value = s
|
||||
}
|
||||
|
||||
function toggleBrightness() {
|
||||
brightness.value = isDark.value ? 'light' : 'dark'
|
||||
}
|
||||
|
||||
function toggleStyle() {
|
||||
style.value = isComic.value ? 'ink' : 'comic'
|
||||
}
|
||||
|
||||
return {
|
||||
mode,
|
||||
brightness,
|
||||
style,
|
||||
isDark,
|
||||
setMode,
|
||||
toggleTheme,
|
||||
isComic,
|
||||
themeName,
|
||||
setBrightness,
|
||||
setStyle,
|
||||
toggleBrightness,
|
||||
toggleStyle,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
@use 'variables' as *;
|
||||
@use 'code-block';
|
||||
|
||||
@font-face {
|
||||
font-family: 'Comic Neue';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('/fonts/ComicNeue-Regular.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Comic Neue';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url('/fonts/ComicNeue-Bold.ttf') format('truetype');
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
@@ -9,6 +25,13 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
:root {
|
||||
--vh: 1vh;
|
||||
}
|
||||
@@ -45,6 +68,21 @@ body {
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
html.comic body {
|
||||
font-weight: var(--comic-font-weight, 700);
|
||||
}
|
||||
|
||||
html.comic button,
|
||||
html.comic input,
|
||||
html.comic select,
|
||||
html.comic textarea,
|
||||
html.comic a,
|
||||
html.comic span,
|
||||
html.comic div,
|
||||
html.comic label {
|
||||
font-weight: var(--comic-font-weight, 700);
|
||||
}
|
||||
|
||||
code, pre, .mono {
|
||||
font-family: $font-code;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,15 @@ export const darkThemeOverrides: GlobalThemeOverrides = {
|
||||
},
|
||||
}
|
||||
|
||||
export function getThemeOverrides(isDark: boolean): GlobalThemeOverrides {
|
||||
return isDark ? darkThemeOverrides : lightThemeOverrides
|
||||
export function getThemeOverrides(isDark: boolean, isComic?: boolean): GlobalThemeOverrides {
|
||||
const base = isDark ? darkThemeOverrides : lightThemeOverrides
|
||||
if (!isComic) return base
|
||||
const comicFont = "'Comic Neue', 'Comic Sans MS', cursive, sans-serif"
|
||||
return {
|
||||
...base,
|
||||
common: {
|
||||
...base.common!,
|
||||
fontFamily: comicFont,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 黑白水墨 — Pure Ink
|
||||
// 纯黑白灰,无彩色
|
||||
// 支持 light / dark 双主题
|
||||
// 支持 light / dark / comic 三主题
|
||||
|
||||
// ─── CSS Custom Properties ─────────────────────────────────────
|
||||
|
||||
@@ -108,6 +108,28 @@
|
||||
--accent-info-rgb: 107, 163, 214;
|
||||
}
|
||||
|
||||
.comic {
|
||||
// Borders — bold comic outlines
|
||||
--border-color: #1a1a1a;
|
||||
--border-light: #555555;
|
||||
--msg-system-border: #1a1a1a;
|
||||
|
||||
// Comic-specific
|
||||
--font-ui: 'Comic Neue', 'Comic Sans MS', cursive, sans-serif;
|
||||
--comic-border-width: 2.5px;
|
||||
--comic-shadow: 3px 3px 0px rgba(0, 0, 0, 0.15);
|
||||
--comic-font-weight: 700;
|
||||
}
|
||||
|
||||
.dark.comic {
|
||||
// Borders — brighter outlines on dark
|
||||
--border-color: #666666;
|
||||
--border-light: #555555;
|
||||
--msg-system-border: #888888;
|
||||
|
||||
--comic-shadow: 3px 3px 0px rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
// ─── SCSS Variables (delegate to CSS custom properties) ────────
|
||||
|
||||
// Backgrounds
|
||||
@@ -147,7 +169,7 @@ $msg-system-border: var(--msg-system-border);
|
||||
$code-bg: var(--code-bg);
|
||||
|
||||
// Typography
|
||||
$font-ui: 'Inter', system-ui, -apple-system, sans-serif;
|
||||
$font-ui: var(--font-ui, 'Inter', system-ui, -apple-system, sans-serif);
|
||||
$font-code: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
|
||||
|
||||
// Layout
|
||||
|
||||
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.8 MiB |