diff --git a/apps/desktop/src/app/settings/appearance-settings.tsx b/apps/desktop/src/app/settings/appearance-settings.tsx index 64c3be3245..ca16163903 100644 --- a/apps/desktop/src/app/settings/appearance-settings.tsx +++ b/apps/desktop/src/app/settings/appearance-settings.tsx @@ -48,6 +48,7 @@ import { TRANSLUCENCY_STEP, TRANSLUCENCY_SUPPORTED } from '@/store/translucency' +import { $userBubbleTransparency, setUserBubbleTransparency } from '@/store/user-bubble-transparency' import { $vibeHeartsEnabled, setVibeHeartsEnabled } from '@/store/vibe-hearts-enabled' import { $zoomPercent, setZoomPercent } from '@/store/zoom' import { getBaseColors, useTheme } from '@/themes/context' @@ -402,6 +403,7 @@ export function AppearanceSettings() { const composerPopoutGesturesEnabled = useStore($composerPopoutGesturesEnabled) const translucency = useStore($translucency) const glassMode = translucency.mode === 'glass' && GLASS_SUPPORTED + const userBubbleTransparency = useStore($userBubbleTransparency) const reactionsEnabled = useStore($reactionsEnabled) const tipsEnabled = useStore($tipsEnabled) const toursEnabled = useStore($toursEnabled) @@ -743,6 +745,24 @@ export function AppearanceSettings() { /> )} + + + + } + description={a.userBubbleDesc} + id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.userBubble)} + title={a.userBubbleTitle} + /> + ( + typeof window === 'undefined' ? TRANSLUCENCY_MIN : clampIntensity(storedString(KEY)) +) + +export function setUserBubbleTransparency(value: number): void { + $userBubbleTransparency.set(clampIntensity(value)) +} + +if (typeof window !== 'undefined') { + $userBubbleTransparency.subscribe(value => { + const root = document.documentElement + + // The default paints nothing: styles.css falls back to the full fill, so a + // user who never touched the lever gets byte-identical CSS to before. + if (value === TRANSLUCENCY_MIN) { + root.style.removeProperty('--user-bubble-keep') + persistString(KEY, null) + } else { + root.style.setProperty('--user-bubble-keep', `${TRANSLUCENCY_MAX - value}%`) + persistString(KEY, String(value)) + } + }) +} diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css index c0ff2b7cb8..a06e8af50a 100644 --- a/apps/desktop/src/styles.css +++ b/apps/desktop/src/styles.css @@ -432,7 +432,12 @@ --dt-destructive-foreground: #ffffff; --dt-sidebar-bg: var(--ui-bg-sidebar); --dt-sidebar-border: var(--ui-stroke-secondary); - --dt-user-bubble: var(--ui-chat-bubble-background); + /* `--user-bubble-keep` is the Settings → Appearance → Message Bubble lever + (store/user-bubble-transparency.ts): the share of the theme's bubble + fill to keep. Unset at the default, so the mix is a no-op and the bubble + is the theme's fill exactly as before. The border stays put either way — + at full transparency the outline is what still marks your turn. */ + --dt-user-bubble: color-mix(in srgb, var(--ui-chat-bubble-background) var(--user-bubble-keep, 100%), transparent); --dt-user-bubble-border: var(--ui-stroke-tertiary); --dt-font-sans: