@@ -279,6 +279,42 @@ test("collapses identical V1 backgrounds when both variants infer one mode", ()
279279 expect ( selectThemeMode ( migratedLight , "dark" ) . mode ) . toBe ( "light" )
280280} )
281281
282+ test ( "gives dialogs an opaque background when V1 panels are see-through" , ( ) => {
283+ const lucent = DEFAULT_THEMES [ "lucent-orng" ] !
284+ for ( const mode of [ "dark" , "light" ] as const ) {
285+ const legacy = resolveV1 ( lucent , mode )
286+ const dialog = resolveThemeDocument ( migrateV1 ( lucent ) , mode ) . surface ( "dialog" )
287+ expect ( legacy . backgroundPanel . a ) . toBe ( 0 )
288+ const [ red , green , blue ] = legacy . backgroundMenu . toInts ( )
289+ expect ( legacy . backgroundMenu . a ) . toBeLessThan ( 1 )
290+ expect ( dialog . background . base . toInts ( ) ) . toEqual ( [ red , green , blue , 255 ] )
291+ }
292+
293+ const source = structuredClone ( opencodeV1 )
294+ source . theme . background = "transparent"
295+ source . theme . backgroundPanel = "transparent"
296+ source . theme . backgroundElement = "transparent"
297+ source . theme . backgroundMenu = "transparent"
298+ expect ( hex ( resolveThemeDocument ( migrateV1 ( source ) , "dark" ) . surface ( "dialog" ) . background . base ) ) . toBe ( "#000000" )
299+ expect ( hex ( resolveThemeDocument ( migrateV1 ( source ) , "light" ) . surface ( "dialog" ) . background . base ) ) . toBe ( "#ffffff" )
300+
301+ const opaque = resolveThemeDocument ( migrateV1 ( opencodeV1 ) , "dark" )
302+ expect ( hex ( opaque . surface ( "dialog" ) . background . base ) ) . toBe ( hex ( opaque . background . raised . base ) )
303+ } )
304+
305+ test ( "gives new designs dialogs an opaque background when V1 panels are see-through" , ( ) => {
306+ const lucent = DEFAULT_THEMES [ "lucent-orng" ] !
307+ for ( const mode of [ "dark" , "light" ] as const ) {
308+ const [ red , green , blue ] = resolveV1 ( lucent , mode ) . backgroundMenu . toInts ( )
309+ const dialog = resolveThemeDocument ( migrateV1NewDesigns ( lucent ) , mode ) . surface ( "dialog" )
310+ expect ( dialog . background . base . toInts ( ) ) . toEqual ( [ red , green , blue , 255 ] )
311+ }
312+
313+ const opaque = migrateV1NewDesigns ( DEFAULT_THEMES . tokyonight ! )
314+ expect ( opaque . base [ "@dialog" ] ?. background ?. base ) . toBe ( "$background.raised.base" )
315+ expect ( opaque . light ?. [ "@dialog" ] ?. background ?. base ) . toBe ( "$hue.neutral.800" )
316+ } )
317+
282318test ( "keeps both modes when a shared background has different contrast" , ( ) => {
283319 const source = structuredClone ( opencodeV1 )
284320 source . theme . background = "#808080"
0 commit comments