File tree 12 files changed +732
-72
lines changed
12 files changed +732
-72
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ import { ExtendActivityBar } from './activityBar';
2
2
import { ExtendExplore } from './explore' ;
3
3
import { ExtendSearch } from './search' ;
4
4
import { ExtendStatusBar } from './statusBar' ;
5
-
6
- const Themes = require ( './theme-defaults/package.json' ) ;
5
+ import { defaultColorThemeExtension } from './theme-defaults' ;
6
+ import { monokaiColorThemeExtension } from './theme-monokai' ;
7
+ import { paleNightColorThemeExtension } from './vscode-palenight-theme' ;
7
8
8
9
/**
9
10
* Default extensions
@@ -13,5 +14,7 @@ export const defaultExtensions = [
13
14
ExtendExplore ,
14
15
ExtendSearch ,
15
16
ExtendStatusBar ,
16
- Themes ,
17
+ defaultColorThemeExtension ,
18
+ monokaiColorThemeExtension ,
19
+ paleNightColorThemeExtension ,
17
20
] ;
Original file line number Diff line number Diff line change
1
+ import { IColorTheme } from "mo/model/colorTheme" ;
2
+ import { IExtension , IExtensionType } from "mo/model/extension" ;
3
+
4
+ const colorThemesExtension : IExtension = require ( './package.json' ) ;
5
+
6
+ function initColorTheme ( ) {
7
+
8
+ try {
9
+
10
+ if ( ! colorThemesExtension || ! colorThemesExtension . categories ?. includes ( IExtensionType . Theme ) ) {
11
+ console . error ( 'This is invalid colorTheme extension package!' , colorThemesExtension ) ;
12
+ }
13
+
14
+ const themes = colorThemesExtension . contributes ?. themes ?. map ( ( theme : IColorTheme ) => {
15
+ if ( theme . path ) {
16
+ const themeDetail = { } ; // require(theme.path);
17
+ return Object . assign ( { } , theme , themeDetail )
18
+ }
19
+ return theme ;
20
+ } ) ;
21
+
22
+ if ( ! colorThemesExtension . contributes ) {
23
+ colorThemesExtension . contributes = { themes : [ ] } ;
24
+ }
25
+
26
+ colorThemesExtension . contributes . themes = themes ;
27
+ } catch ( e ) {
28
+ throw new Error ( 'Load color theme exception:' + e ) ;
29
+ }
30
+ }
31
+
32
+ initColorTheme ( ) ;
33
+
34
+ export {
35
+ colorThemesExtension
36
+ }
Original file line number Diff line number Diff line change @@ -8,12 +8,15 @@ export interface TokenColor extends Object {
8
8
settings ?: object ;
9
9
}
10
10
11
- export interface ITheme {
11
+ export interface IColorTheme {
12
12
/**
13
13
* The id of component, theme will be applied by this ID
14
14
*/
15
15
id : string ;
16
+ label : string ;
16
17
name : string ;
18
+ uiTheme : string ;
19
+ path ?: string ;
17
20
colors ?: ThemeColor ;
18
21
tokenColors ?: TokenColor [ ] ;
19
22
/**
Original file line number Diff line number Diff line change 1
1
import { IExtensionService } from 'mo/services' ;
2
+ import { IColorTheme } from './colorTheme' ;
3
+ import { IIconTheme } from './iconTheme' ;
2
4
3
5
/**
4
6
* Defines extension types
5
7
*/
6
8
export enum IExtensionType {
7
- Theme = 'themes ' ,
9
+ Theme = 'Themes ' ,
8
10
Normal = 'normal' ,
9
11
Settings = 'settings' ,
10
12
Locals = 'locals' ,
@@ -17,13 +19,17 @@ export enum IContributeType {
17
19
Commands = 'commands' ,
18
20
Configuration = 'configuration' ,
19
21
Grammar = 'grammars' ,
22
+ Theme = 'themes' ,
23
+ IconTheme = 'iconThemes' ,
20
24
}
21
25
22
26
export interface IContribute {
23
- [ IContributeType . Languages ] : any ;
24
- [ IContributeType . Commands ] : any ;
25
- [ IContributeType . Configuration ] : any ;
26
- [ IContributeType . Grammar ] : any ;
27
+ [ IContributeType . Languages ] ?: any ;
28
+ [ IContributeType . Commands ] ?: any ;
29
+ [ IContributeType . Configuration ] ?: any ;
30
+ [ IContributeType . Grammar ] ?: any ;
31
+ [ IContributeType . Theme ] ?: IColorTheme [ ] ;
32
+ [ IContributeType . IconTheme ] ?: IIconTheme [ ] ;
27
33
}
28
34
29
35
/**
Original file line number Diff line number Diff line change 1
- import { ITheme } from './theme' ;
1
+ import { IColorTheme } from './colorTheme' ;
2
+ import { IIconTheme } from './iconTheme' ;
2
3
3
4
export interface IUI {
4
- colorTheme ?: ITheme ;
5
- iconTheme ?: ITheme ;
5
+ colorTheme ?: IColorTheme ;
6
+ iconTheme ?: IIconTheme ;
6
7
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import 'mo/style/main.scss';
2
2
import 'vscode-codicons/dist/codicon.css' ;
3
3
import * as React from 'react' ;
4
4
import { container } from 'tsyringe' ;
5
- import { ITheme } from 'mo/model/theme ' ;
5
+ import { IColorTheme } from 'mo/model/colorTheme ' ;
6
6
import { defaultExtensions } from 'mo/extensions' ;
7
7
import { IExtension } from 'mo/model/extension' ;
8
8
import { ILocalization } from 'mo/model/localization' ;
@@ -14,7 +14,7 @@ import {
14
14
interface Props {
15
15
extensions ?: IExtension [ ] ;
16
16
locales ?: ILocalization [ ] ;
17
- colorTheme ?: ITheme [ ] ;
17
+ colorTheme ?: IColorTheme [ ] ;
18
18
}
19
19
20
20
export const MoleculeCtx = React . createContext ( { } ) ;
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ import 'reflect-metadata';
2
2
import { container } from 'tsyringe' ;
3
3
4
4
export * from './extensionService' ;
5
- export * from './themeService ' ;
5
+ export * from './theme/colorThemeService ' ;
6
6
export * from './workbench' ;
7
7
8
- import { ThemeService } from './themeService ' ;
8
+ import { ColorThemeService , IColorThemeService } from './theme/colorThemeService ' ;
9
9
import { ExtensionService , IExtensionService } from './extensionService' ;
10
10
import {
11
11
ActivityBarService ,
@@ -39,7 +39,7 @@ const statusBarService = container.resolve<IStatusBarService>(StatusBarService);
39
39
* The theme service,
40
40
* TODO: think about break themeService into ColorTheme and IconTheme
41
41
*/
42
- const themeService = container . resolve ( ThemeService ) ;
42
+ const colorThemeService = container . resolve < IColorThemeService > ( ColorThemeService ) ;
43
43
44
44
/**
45
45
* Note: The extension service depends on other workbench services,
@@ -55,5 +55,5 @@ export {
55
55
statusBarService ,
56
56
editorService ,
57
57
extensionService ,
58
- themeService ,
58
+ colorThemeService ,
59
59
} ;
Original file line number Diff line number Diff line change
1
+ const ColorMap = new Map < Symbol , string > ( ) ;
2
+
3
+ export {
4
+ ColorMap
5
+ }
You can’t perform that action at this time.
0 commit comments