From 7762fa5ddf6aed860a9f3878e16d40ba8010b6cc Mon Sep 17 00:00:00 2001 From: davecrab <65996799+davecrab@users.noreply.github.com> Date: Tue, 18 Nov 2025 21:55:52 -0800 Subject: [PATCH] feat: Add adjustable text size setting to interface (#19186) * Add adjustable text size setting to interface Introduces a user-configurable text size (scale) setting, accessible via a slider in the interface settings. Updates CSS and Sidebar chat item components to respect the new --app-text-scale variable, and persists the setting in the store. Adds related i18n strings and ensures the text scale is applied globally and clamped to allowed values. * Refactor text scale logic into utility module Moved all text scale related constants and functions from components and stores into a new utility module (src/lib/utils/text-scale.ts). Updated imports and usage in Interface.svelte and index.ts to use the new module, improving code organization and reusability. * Adjust sidebar chat scaling without extra classes keep sidebar markup using existing Tailwind utility classes so chat items render identically pre-feature move all text-scale sizing into app.css under the #sidebar-chat-item selectors change the root font-size multiplier to use 1rem instead of an explicit 16px so browser/user preferences propagate * Update Switch.svelte Adjust toggles from fixed pixel to rem to scale with the text size * Update Interface.svelte Updated label from 'Text Scale' to 'UI Scale'. Added padding around slider * Update app.css Added comments --- src/app.css | 25 ++++ .../components/chat/Settings/Interface.svelte | 122 +++++++++++++++++- src/lib/components/common/Switch.svelte | 2 +- .../components/layout/Sidebar/ChatItem.svelte | 5 +- src/lib/i18n/locales/en-US/translation.json | 3 + src/lib/stores/index.ts | 9 ++ src/lib/utils/text-scale.ts | 55 ++++++++ 7 files changed, 216 insertions(+), 5 deletions(-) create mode 100644 src/lib/utils/text-scale.ts diff --git a/src/app.css b/src/app.css index f4e3225d3b..9646c0f9ce 100644 --- a/src/app.css +++ b/src/app.css @@ -30,8 +30,33 @@ font-display: swap; } +/* --app-text-scale is updated via the UI Scale slider (Interface.svelte) */ +:root { + --app-text-scale: 1; +} + html { word-break: break-word; + /* font-size scales the entire document via the same UI control */ + font-size: calc(1rem * var(--app-text-scale, 1)); +} + +#sidebar-chat-item { + /* sidebar item sizing scales for the chat list entries */ + min-height: calc(32px * var(--app-text-scale, 1)); + padding-inline: calc(11px * var(--app-text-scale, 1)); + padding-block: calc(6px * var(--app-text-scale, 1)); +} + +#sidebar-chat-item div[dir='auto'] { + /* chat title line height follows the text scale */ + height: calc(20px * var(--app-text-scale, 1)); + line-height: calc(20px * var(--app-text-scale, 1)); +} + +#sidebar-chat-item input { + /* editing state input height is kept in sync */ + min-height: calc(20px * var(--app-text-scale, 1)); } code { diff --git a/src/lib/components/chat/Settings/Interface.svelte b/src/lib/components/chat/Settings/Interface.svelte index 15debe669c..1b0d978ae5 100644 --- a/src/lib/components/chat/Settings/Interface.svelte +++ b/src/lib/components/chat/Settings/Interface.svelte @@ -1,6 +1,6 @@ @@ -331,6 +393,64 @@ +