@@ -13,48 +13,29 @@ loader.config({ monaco });
1313export const GITHUB_LIGHT_DEFAULT = 'github-light-default' ;
1414export const GITHUB_DARK_DEFAULT = 'github-dark-default' ;
1515
16- // Lightweight RGBA helper
17- function rgba ( hex : string , alpha : number ) {
18- const h = hex . replace ( '#' , '' ) ;
19- const v =
20- h . length === 3
21- ? h
22- . split ( '' )
23- . map ( ( c ) => c + c )
24- . join ( '' )
25- : h ;
26- const n = parseInt ( v , 16 ) ;
27- // If parse fails, fallback to transparent
28- if ( Number . isNaN ( n ) ) return `rgba(0,0,0,${ alpha } )` ;
29- const r = ( n >> 16 ) & 255 ;
30- const g = ( n >> 8 ) & 255 ;
31- const b = n & 255 ;
32- return `rgba(${ r } , ${ g } , ${ b } , ${ alpha } )` ;
33- }
34-
3516// Inlined GitHub Light Default editor colors (subset focused on Monaco editor UI)
3617const GITHUB_LIGHT_EDITOR_COLORS : monaco . editor . IColors = {
3718 'editor.foreground' : '#1f2328' ,
3819 'editor.background' : '#ffffff' ,
3920 'editorWidget.background' : '#f6f8fa' ,
4021 'editor.lineHighlightBackground' : '#eaeef2' ,
4122 'editorCursor.foreground' : '#0969da' ,
42- 'editor.selectionBackground' : rgba ( '#0969da ', 0.2 ) ,
43- 'editor.inactiveSelectionBackground' : rgba ( '#0969da ', 0.07 ) ,
44- 'editor.selectionHighlightBackground' : rgba ( '#1a7f37 ', 0.25 ) ,
23+ 'editor.selectionBackground' : '#0969da33 ', // 20% opacity
24+ 'editor.inactiveSelectionBackground' : '#0969da12 ', // 7% opacity
25+ 'editor.selectionHighlightBackground' : '#1a7f3740 ', // 25% opacity
4526 'editorLineNumber.foreground' : '#8c959f' ,
4627 'editorLineNumber.activeForeground' : '#1f2328' ,
47- 'editorIndentGuide.background' : rgba ( '#1f2328 ', 0.12 ) ,
48- 'editorIndentGuide.activeBackground' : rgba ( '#1f2328 ', 0.24 ) ,
28+ 'editorIndentGuide.background' : '#1f23281f ', // 12% opacity
29+ 'editorIndentGuide.activeBackground' : '#1f23283d ', // 24% opacity
4930 'editorGutter.background' : '#ffffff' ,
5031 'editorHoverWidget.background' : '#f6f8fa' ,
5132 'editorHoverWidget.border' : '#d0d7de' ,
5233 'editorSuggestWidget.background' : '#f6f8fa' ,
5334 'editorSuggestWidget.border' : '#d0d7de' ,
5435 'editorWidget.border' : '#d0d7de' ,
5536 'editorWhitespace.foreground' : '#d0d7de' ,
56- 'editor.wordHighlightBackground' : rgba ( '#afb8c1 ', 0.5 ) ,
57- 'editor.wordHighlightStrongBackground' : rgba ( '#afb8c1 ', 0.3 ) ,
37+ 'editor.wordHighlightBackground' : '#afb8c180 ', // 50% opacity
38+ 'editor.wordHighlightStrongBackground' : '#afb8c14d ', // 30% opacity
5839} ;
5940
6041// Inlined GitHub Dark Default editor colors (subset focused on Monaco editor UI)
@@ -64,22 +45,22 @@ const GITHUB_DARK_EDITOR_COLORS: monaco.editor.IColors = {
6445 'editorWidget.background' : '#161b22' ,
6546 'editor.lineHighlightBackground' : '#161b22' ,
6647 'editorCursor.foreground' : '#2f81f7' ,
67- 'editor.selectionBackground' : rgba ( '#2f81f7 ', 0.2 ) ,
68- 'editor.inactiveSelectionBackground' : rgba ( '#2f81f7 ', 0.07 ) ,
69- 'editor.selectionHighlightBackground' : rgba ( '#2ea043 ', 0.25 ) ,
48+ 'editor.selectionBackground' : '#2f81f733 ', // 20% opacity
49+ 'editor.inactiveSelectionBackground' : '#2f81f712 ', // 7% opacity
50+ 'editor.selectionHighlightBackground' : '#2ea04340 ', // 25% opacity
7051 'editorLineNumber.foreground' : '#6e7681' ,
7152 'editorLineNumber.activeForeground' : '#e6edf3' ,
72- 'editorIndentGuide.background' : rgba ( '#e6edf3 ', 0.12 ) ,
73- 'editorIndentGuide.activeBackground' : rgba ( '#e6edf3 ', 0.24 ) ,
53+ 'editorIndentGuide.background' : '#e6edf31f ', // 12% opacity
54+ 'editorIndentGuide.activeBackground' : '#e6edf33d ', // 24% opacity
7455 'editorGutter.background' : '#0d1117' ,
7556 'editorHoverWidget.background' : '#161b22' ,
7657 'editorHoverWidget.border' : '#30363d' ,
7758 'editorSuggestWidget.background' : '#161b22' ,
7859 'editorSuggestWidget.border' : '#30363d' ,
7960 'editorWidget.border' : '#30363d' ,
8061 'editorWhitespace.foreground' : '#484f58' ,
81- 'editor.wordHighlightBackground' : rgba ( '#6e7681 ', 0.5 ) ,
82- 'editor.wordHighlightStrongBackground' : rgba ( '#6e7681 ', 0.3 ) ,
62+ 'editor.wordHighlightBackground' : '#6e768180 ', // 50% opacity
63+ 'editor.wordHighlightStrongBackground' : '#6e76814d ', // 30% opacity
8364} ;
8465
8566export const configureMonaco = ( ) => {
0 commit comments