Skip to content

feat(themes): add built-in Lens theme with contextual palette switcher - #66

Merged
funnycups merged 6 commits into
funnycups:releasefrom
xzhouzhou758:feat/lens-theme
Nov 22, 2026
Merged

funnycups merged 6 commits into
funnycups:releasefrom
xzhouzhou758:feat/lens-theme

Conversation

@xzhouzhou758

Copy link
Copy Markdown
Contributor

Why

Luker's built-in themes currently consist of lightweight color presets without a modern frosted-glass / low-glare reading theme or a built-in way to switch between dark, light, and flat low-GPU palettes without relying on third-party Quick Reply sets that clutter the input bar across unrelated themes.

Changes

  • Built-in Lens theme (default/content/themes/Lens.json & default/content/index.json):

    • Added 4 coordinated palettes under one theme: Night (default dark frosted glass), Mist (light frosted glass), Ink (flat slate dark, 0 backdrop blur), and Paper (flat warm reading light, 0 backdrop blur).
    • Stabilized cross-browser typography by fixing root font-size: 15px, disabling mobile font inflation (-webkit-text-size-adjust: 100%; text-size-adjust: 100%), mounting a consistent system CJK/Latin sans-serif font stack (--lt-font), and exposing --lt-size / --lt-weight (400) in the adjustable header.
    • Optimized rendering performance: flat palettes set backdrop-filter: none and hide the background gradient pseudo-element (display: none) to avoid offscreen GPU readbacks; frosted palettes cap blur at 16px desktop / 8px mobile (contain: strict static layer on #bg1::after); added contain: layout style per .mes bubble and removed fullscreen dialog::backdrop blur.
    • Refined Markdown tables, Select2 dropdowns, light-mode unchecked checkboxes, and desktop flat-mode #chat edge borders.
  • Contextual palette switcher (public/scripts/lens-palette.js, public/css/lens-palette.css, public/scripts/power-user.js):

    • Embeds a slim 5-swatch strip (Night / Mist / Ink / Paper / Auto) at the top of the bottom-left #options (•••) menu without widening the menu (~150px) and without adding any persistent button to the top bar or input bar.
    • Strictly scoped to themes declaring --lt-theme: 1; switching away to any other theme immediately hides the strip, removes html[data-lt-palette] / lt-theme-active, and restores <meta name="theme-color">.
    • Supports Auto mode tracking prefers-color-scheme, persists preference in localStorage, triggers syncIosSystemBarsColor / syncAndroidSystemBarsColor on palette change, gently syncs same-origin adaptive card iframes, and guards #chat against stale legacy Quick Reply --lt-palette inline writes.
    • Added zh-CN and zh-TW translations in public/locales/zh-cn.json and public/locales/zh-tw.json.
  • Tests (tests/lens-palette.test.js):

    • Added unit tests covering default/content/index.json registration, Lens.json palette/performance invariants, mode resolution (0–3 & auto), contextual mounting/cleanup when switching themes, and legacy #chat inline style cleanup.

Verification

  • node scripts/check-plugin-imports.js -> 0 violations
  • npx eslint --quiet public/scripts/lens-palette.js public/scripts/power-user.js tests/lens-palette.test.js -> 0 errors
  • NODE_OPTIONS=--experimental-vm-modules npx jest tests/lens-palette.test.js -> 1 suite / 5 tests passed
  • Verified visually in a real browser across desktop (1280x800) and mobile (390x844) viewports in all 4 palettes plus theme-switching cleanup.

@funnycups
funnycups merged commit 60c5fe5 into funnycups:release Nov 22, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants