@@ -6,7 +6,7 @@ export interface UseMonacoDiffOptions {
66 original : string
77 modified : string
88 language : string
9- colorMode ?: 'light' | 'dark'
9+ colorMode : Ref < 'light' | 'dark' >
1010 editorOptions ?: Editor . IStandaloneDiffEditorConstructionOptions
1111}
1212
@@ -23,9 +23,10 @@ export function useMonacoDiff(target: Ref, options: UseMonacoDiffOptions) {
2323 if ( ! el || isInitialized ) return
2424
2525 const monaco = await setupMonaco ( )
26+ const colorMode = unref ( options . colorMode ) || 'dark'
2627
2728 editor = monaco . createDiffEditor ( el , {
28- theme : getTheme ( options . colorMode ) ,
29+ theme : getTheme ( colorMode ) ,
2930 lineNumbers : 'off' ,
3031 readOnly : true ,
3132 renderSideBySide : true ,
@@ -36,6 +37,14 @@ export function useMonacoDiff(target: Ref, options: UseMonacoDiffOptions) {
3637 ...options . editorOptions ,
3738 } )
3839
40+ // Watch for color mode changes
41+ watch ( options . colorMode , ( newMode ) => {
42+ editor ?. updateOptions ( {
43+ // @ts -expect-error -- theme is missing from IDiffEditorOptions
44+ theme : getTheme ( newMode ) ,
45+ } )
46+ } )
47+
3948 editor . setModel ( {
4049 original : monaco . editor . createModel ( options . original , options . language ) ,
4150 modified : monaco . editor . createModel ( options . modified , options . language ) ,
0 commit comments