@@ -7,24 +7,7 @@ import { IExtension } from 'mo/model/extension';
7
7
import { ITheme , ThemeColor , TokenColor } from 'mo/model/theme' ;
8
8
import { container , inject , singleton } from 'tsyringe' ;
9
9
import * as monaco from 'monaco-editor' ;
10
-
11
- /**
12
- * Apply css content to workbench
13
- * @param styleSheetContent CSS sheet content
14
- * @param rulesClassName Style tag class Name
15
- */
16
- function _applyRules ( styleSheetContent : string , rulesClassName : string ) {
17
- const themeStyles = document . head . getElementsByClassName ( rulesClassName ) ;
18
- if ( themeStyles . length === 0 ) {
19
- const elStyle = document . createElement ( 'style' ) ;
20
- elStyle . type = 'text/css' ;
21
- elStyle . className = rulesClassName ;
22
- elStyle . innerHTML = styleSheetContent ;
23
- document . head . appendChild ( elStyle ) ;
24
- } else {
25
- ( < HTMLStyleElement > themeStyles [ 0 ] ) . innerHTML = styleSheetContent ;
26
- }
27
- }
10
+ import { applyStyleSheetRules } from 'mo/common/css' ;
28
11
29
12
@singleton ( )
30
13
export class ThemeService implements ITheme {
@@ -60,7 +43,7 @@ export class ThemeService implements ITheme {
60
43
public getThemeById ( themeId : string , extension : IExtension ) { }
61
44
62
45
public applyTheme ( ) {
63
- _applyRules ( '' , '' ) ;
46
+ applyStyleSheetRules ( '' , '' ) ;
64
47
}
65
48
}
66
49
0 commit comments