@@ -21,18 +21,30 @@ const MAX_CUSTOM_MODEL_COUNT = 32;
2121export const MAX_CUSTOM_MODEL_LENGTH = 256 ;
2222const BACKGROUND_IMAGE_KEY = "okcode:background-image" ;
2323const BACKGROUND_OPACITY_KEY = "okcode:background-opacity" ;
24+ // Sidebar density constraints are tuned to keep rows within
25+ // best-practice layouts and ratios. Tap targets stay >=28px,
26+ // rows stay below an upper bound that preserves list density,
27+ // and font/spacing values stay inside a legibility window.
2428export const SIDEBAR_PROJECT_ROW_HEIGHT_MIN = 32 ;
25- export const SIDEBAR_PROJECT_ROW_HEIGHT_MAX = 72 ;
29+ export const SIDEBAR_PROJECT_ROW_HEIGHT_MAX = 48 ;
2630export const DEFAULT_SIDEBAR_PROJECT_ROW_HEIGHT = 32 ;
27- export const SIDEBAR_THREAD_ROW_HEIGHT_MIN = 24 ;
28- export const SIDEBAR_THREAD_ROW_HEIGHT_MAX = 44 ;
31+ export const SIDEBAR_THREAD_ROW_HEIGHT_MIN = 28 ;
32+ export const SIDEBAR_THREAD_ROW_HEIGHT_MAX = 40 ;
2933export const DEFAULT_SIDEBAR_THREAD_ROW_HEIGHT = 28 ;
30- export const SIDEBAR_FONT_SIZE_MIN = 10 ;
31- export const SIDEBAR_FONT_SIZE_MAX = 16 ;
34+ export const SIDEBAR_FONT_SIZE_MIN = 11 ;
35+ export const SIDEBAR_FONT_SIZE_MAX = 15 ;
3236export const DEFAULT_SIDEBAR_FONT_SIZE = 12 ;
33- export const SIDEBAR_SPACING_MIN = 4 ;
37+ export const SIDEBAR_SPACING_MIN = 6 ;
3438export const SIDEBAR_SPACING_MAX = 12 ;
3539export const DEFAULT_SIDEBAR_SPACING = 8 ;
40+ // Transparency floors keep the sidebar readable and prevent
41+ // background images from competing with foreground content.
42+ export const SIDEBAR_OPACITY_MIN = 0.6 ;
43+ export const SIDEBAR_OPACITY_MAX = 1 ;
44+ export const DEFAULT_SIDEBAR_OPACITY = 1 ;
45+ export const BACKGROUND_IMAGE_OPACITY_MIN = 0.05 ;
46+ export const BACKGROUND_IMAGE_OPACITY_MAX = 0.35 ;
47+ export const DEFAULT_BACKGROUND_IMAGE_OPACITY = 0.15 ;
3648export const DEFAULT_BROWSER_PREVIEW_START_PAGE_URL = "https://www.google.com/" ;
3749
3850export const TimestampFormat = Schema . Literals ( [ "locale" , "12-hour" , "24-hour" ] ) ;
@@ -94,7 +106,7 @@ export const AppSettingsSchema = Schema.Struct({
94106 codexBinaryPath : Schema . String . check ( Schema . isMaxLength ( 4096 ) ) . pipe ( withDefaults ( ( ) => "" ) ) ,
95107 codexHomePath : Schema . String . check ( Schema . isMaxLength ( 4096 ) ) . pipe ( withDefaults ( ( ) => "" ) ) ,
96108 backgroundImageUrl : Schema . String . check ( Schema . isMaxLength ( 4096 ) ) . pipe ( withDefaults ( ( ) => "" ) ) ,
97- backgroundImageOpacity : Schema . Number . pipe ( withDefaults ( ( ) => 0.15 ) ) ,
109+ backgroundImageOpacity : Schema . Number . pipe ( withDefaults ( ( ) => DEFAULT_BACKGROUND_IMAGE_OPACITY ) ) ,
98110 defaultThreadEnvMode : EnvMode . pipe ( withDefaults ( ( ) => "worktree" as const satisfies EnvMode ) ) ,
99111 autoUpdateWorktreeBaseBranch : Schema . Boolean . pipe ( withDefaults ( ( ) => false ) ) ,
100112 confirmThreadDelete : Schema . Boolean . pipe ( withDefaults ( ( ) => true ) ) ,
@@ -117,7 +129,7 @@ export const AppSettingsSchema = Schema.Struct({
117129 withDefaults ( ( ) => DEFAULT_SIDEBAR_THREAD_SORT_ORDER ) ,
118130 ) ,
119131 timestampFormat : TimestampFormat . pipe ( withDefaults ( ( ) => DEFAULT_TIMESTAMP_FORMAT ) ) ,
120- sidebarOpacity : Schema . Number . pipe ( withDefaults ( ( ) => 1 ) ) ,
132+ sidebarOpacity : Schema . Number . pipe ( withDefaults ( ( ) => DEFAULT_SIDEBAR_OPACITY ) ) ,
121133 sidebarProjectRowHeight : Schema . Number . pipe (
122134 withDefaults ( ( ) => DEFAULT_SIDEBAR_PROJECT_ROW_HEIGHT ) ,
123135 ) ,
@@ -230,11 +242,14 @@ export function normalizeCustomModelSlugs(
230242}
231243
232244function clampOpacity ( value : number ) : number {
233- return Math . max ( 0.3 , Math . min ( 1 , value ) ) ;
245+ return Math . max ( SIDEBAR_OPACITY_MIN , Math . min ( SIDEBAR_OPACITY_MAX , value ) ) ;
234246}
235247
236248function clampBackgroundOpacity ( value : number ) : number {
237- return Math . max ( 0.05 , Math . min ( 1 , value ) ) ;
249+ return Math . max (
250+ BACKGROUND_IMAGE_OPACITY_MIN ,
251+ Math . min ( BACKGROUND_IMAGE_OPACITY_MAX , value ) ,
252+ ) ;
238253}
239254
240255export function clampSidebarProjectRowHeight ( value : number ) : number {
0 commit comments