diff --git a/extensions/theme-colorful-defaults/package.json b/extensions/theme-colorful-defaults/package.json index 8f7719676d0..0175106629d 100644 --- a/extensions/theme-colorful-defaults/package.json +++ b/extensions/theme-colorful-defaults/package.json @@ -4,7 +4,7 @@ "description": "The default VS Code Light and Dark themes with a touch of color. We are considering adding these to the default themes in the January release. Please provide feedback in issue 1849.", "categories": [ "Themes" ], "version": "0.1.10", - "publisher": "aeschli", + "publisher": "vscode", "engines": { "vscode": "*" }, "contributes": { "themes": [ diff --git a/src/vs/platform/theme/common/themes.ts b/src/vs/platform/theme/common/themes.ts index fba05214d49..1909a26f399 100644 --- a/src/vs/platform/theme/common/themes.ts +++ b/src/vs/platform/theme/common/themes.ts @@ -12,8 +12,6 @@ export enum BaseTheme { HIGH_CONTRAST } -export var DEFAULT_THEME_ID = toId(BaseTheme.VS); - export function getBaseThemes(includeHighContrast: boolean): BaseTheme[] { if (includeHighContrast) { return [BaseTheme.VS, BaseTheme.VS_DARK, BaseTheme.HIGH_CONTRAST]; diff --git a/src/vs/workbench/browser/parts/editor/textEditor.ts b/src/vs/workbench/browser/parts/editor/textEditor.ts index 4fa0fa543ea..b75a07c63f0 100644 --- a/src/vs/workbench/browser/parts/editor/textEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textEditor.ts @@ -21,7 +21,7 @@ import {IEditorSelection, IEditor, EventType, IConfigurationChangedEvent, IModel import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService'; import {IFilesConfiguration} from 'vs/platform/files/common/files'; import {Position} from 'vs/platform/editor/common/editor'; -import {DEFAULT_THEME_ID} from 'vs/platform/theme/common/themes'; +import {DEFAULT_THEME_ID} from 'vs/workbench/services/themes/node/themeService'; import {IStorageService, StorageScope, StorageEvent, StorageEventType} from 'vs/platform/storage/common/storage'; import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration'; import {IEventService} from 'vs/platform/event/common/event'; diff --git a/src/vs/workbench/browser/workbench.ts b/src/vs/workbench/browser/workbench.ts index da946a119f9..e87341b1f33 100644 --- a/src/vs/workbench/browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -40,7 +40,7 @@ import {AbstractKeybindingService} from 'vs/platform/keybinding/browser/keybindi import {IUntitledEditorService, UntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService'; import {WorkbenchEditorService} from 'vs/workbench/services/editor/browser/editorService'; import {Position, Parts, IPartService} from 'vs/workbench/services/part/common/partService'; -import {DEFAULT_THEME_ID} from 'vs/platform/theme/common/themes'; +import {DEFAULT_THEME_ID} from 'vs/workbench/services/themes/node/themeService'; import {IWorkspaceContextService as IWorkbenchWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService'; import {IStorageService, StorageScope, StorageEvent, StorageEventType} from 'vs/platform/storage/common/storage'; import {IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace'; diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 5b91eda609b..2e3774b18af 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -93,7 +93,7 @@ import {MainThreadModeServiceImpl} from 'vs/editor/common/services/modeServiceIm import {IModeService} from 'vs/editor/common/services/modeService'; import {IUntitledEditorService, UntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService'; import {CrashReporter} from 'vs/workbench/electron-browser/crashReporter'; -import {IThemeService, ThemeService} from 'vs/workbench/services/themes/node/themeService'; +import {IThemeService, ThemeService, DEFAULT_THEME_ID} from 'vs/workbench/services/themes/node/themeService'; import { IServiceCtor, isServiceEvent } from 'vs/base/common/service'; import { connect, Client } from 'vs/base/node/service.net'; import { IExtensionsService } from 'vs/workbench/parts/extensions/common/extensions'; @@ -400,7 +400,7 @@ export class WorkbenchShell { // Enable theme support let themeId = this.storageService.get(Preferences.THEME, StorageScope.GLOBAL, null); if (!themeId) { - themeId = themes.toId(themes.BaseTheme.VS_DARK); + themeId = DEFAULT_THEME_ID; this.storageService.store(Preferences.THEME, themeId, StorageScope.GLOBAL); } @@ -432,11 +432,10 @@ export class WorkbenchShell { if (!themes.getSyntaxThemeId(themeId)) { applyTheme(); } else { - this.themeService.getTheme(themeId).then(theme => { + this.themeService.loadTheme(themeId).then(theme => { if (theme) { - this.themeService.loadThemeCSS(themeId); + this.themeService.applyThemeCSS(themeId); applyTheme(); - } }, error => { errors.onUnexpectedError(error); diff --git a/src/vs/workbench/parts/html/browser/htmlPreviewPart.ts b/src/vs/workbench/parts/html/browser/htmlPreviewPart.ts index 598b7a2d85a..ee21901e797 100644 --- a/src/vs/workbench/parts/html/browser/htmlPreviewPart.ts +++ b/src/vs/workbench/parts/html/browser/htmlPreviewPart.ts @@ -20,8 +20,8 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito import {ResourceEditorModel} from 'vs/workbench/common/editor/resourceEditorModel'; import {Preferences} from 'vs/workbench/common/constants'; import {HtmlInput} from 'vs/workbench/parts/html/common/htmlInput'; -import {DEFAULT_THEME_ID, isLightTheme} from 'vs/platform/theme/common/themes'; - +import {isLightTheme} from 'vs/platform/theme/common/themes'; +import {DEFAULT_THEME_ID} from 'vs/workbench/services/themes/node/themeService'; /** * An implementation of editor for showing HTML content in an IFrame by leveraging the IFrameEditorInput. */ diff --git a/src/vs/workbench/parts/markdown/common/markdownEditorModel.ts b/src/vs/workbench/parts/markdown/common/markdownEditorModel.ts index 090ffe2abc9..7b5fd614ae1 100644 --- a/src/vs/workbench/parts/markdown/common/markdownEditorModel.ts +++ b/src/vs/workbench/parts/markdown/common/markdownEditorModel.ts @@ -14,6 +14,7 @@ import {Preferences} from 'vs/workbench/common/constants'; import {IModel} from 'vs/editor/common/editorCommon'; import {IEmitOutput} from 'vs/editor/common/modes'; import themes = require('vs/platform/theme/common/themes'); +import {DEFAULT_THEME_ID} from 'vs/workbench/services/themes/node/themeService'; import {MARKDOWN_MIME, MARKDOWN_MODE_ID} from 'vs/workbench/parts/markdown/common/markdown'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage'; @@ -49,7 +50,7 @@ export class MarkdownEditorModel extends IFrameEditorModel { // On Error: Show error to user as rendered HTML let onError = (error: Error) => { try { - let theme = this.storageService.get(Preferences.THEME, StorageScope.GLOBAL, themes.DEFAULT_THEME_ID); + let theme = this.storageService.get(Preferences.THEME, StorageScope.GLOBAL, DEFAULT_THEME_ID); let usesLightTheme = themes.isLightTheme(theme); let markdownError = nls.localize('markdownError', "Unable to open '{0}' for Markdown rendering. Please make sure the file exists and that it is a valid Markdown file.", paths.basename(this.resource.fsPath)); diff --git a/src/vs/workbench/parts/themes/electron-browser/themes.contribution.ts b/src/vs/workbench/parts/themes/electron-browser/themes.contribution.ts index 2ce3cd769d7..8b14c59cb7a 100644 --- a/src/vs/workbench/parts/themes/electron-browser/themes.contribution.ts +++ b/src/vs/workbench/parts/themes/electron-browser/themes.contribution.ts @@ -17,7 +17,7 @@ import workbenchActionRegistry = require('vs/workbench/common/actionRegistry'); import Themes = require('vs/platform/theme/common/themes'); import {IQuickOpenService, IPickOpenEntry} from 'vs/workbench/services/quickopen/common/quickOpenService'; import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; -import {IThemeService, ITheme} from 'vs/workbench/services/themes/node/themeService'; +import {IThemeService, IThemeData, DEFAULT_THEME_ID} from 'vs/workbench/services/themes/node/themeService'; import {ipcRenderer as ipc} from 'electron'; @@ -41,7 +41,7 @@ class SelectThemeAction extends actions.Action { public run(): winjs.Promise { return this.themeService.getThemes().then(contributedThemes => { - let currentTheme = this.storageService.get(Constants.Preferences.THEME, StorageScope.GLOBAL, Themes.DEFAULT_THEME_ID); + let currentTheme = this.storageService.get(Constants.Preferences.THEME, StorageScope.GLOBAL, DEFAULT_THEME_ID); let selectedIndex = 0; let picks: IPickOpenEntry[] = []; @@ -49,7 +49,7 @@ class SelectThemeAction extends actions.Action { picks.push({ label: Themes.toLabel(baseTheme), id: Themes.toId(baseTheme) }); }); - let contributedThemesById : { [id:string]: ITheme } = {}; + let contributedThemesById : { [id:string]: IThemeData } = {}; contributedThemes.forEach(theme => { picks.push({ id: theme.id, label: theme.label, description: theme.description }); contributedThemes[theme.id] = theme; @@ -72,7 +72,7 @@ class SelectThemeAction extends actions.Action { ipc.send('vscode:changeTheme', themeId); } else { // before applying, check that it can be loaded - return this.themeService.loadThemeCSS(themeId).then(_ => { + return this.themeService.applyThemeCSS(themeId).then(_ => { ipc.send('vscode:changeTheme', themeId); }, error => { this.messageService.show(Severity.Info, nls.localize('problemChangingTheme', "Problem loading theme: {0}", error.message)); diff --git a/src/vs/workbench/services/themes/node/themeService.ts b/src/vs/workbench/services/themes/node/themeService.ts index 5549aba4453..adb8504a1c0 100644 --- a/src/vs/workbench/services/themes/node/themeService.ts +++ b/src/vs/workbench/services/themes/node/themeService.ts @@ -20,12 +20,12 @@ export let IThemeService = createDecorator('themeService'); export interface IThemeService { serviceId: ServiceIdentifier; - getTheme(themeId: string): TPromise; - loadThemeCSS(themeId: string): TPromise; - getThemes(): TPromise; + loadTheme(themeId: string): TPromise; + applyThemeCSS(themeId: string): TPromise; + getThemes(): TPromise; } -export interface ITheme { +export interface IThemeData { id: string; label: string; description?: string; @@ -33,6 +33,8 @@ export interface ITheme { styleSheetContent?: string; } +export const DEFAULT_THEME_ID = 'vs-dark vscode-theme-colorful-defaults-themes-dark_plus-tmTheme'; + // implementation let defaultBaseTheme = Themes.toId(Themes.BaseTheme.VS_DARK); @@ -64,7 +66,7 @@ let themesExtPoint = PluginsRegistry.registerExtensionPoint { + public loadTheme(themeId: string): TPromise { return this.getThemes().then(allThemes => { let themes = allThemes.filter(t => t.id === themeId); if (themes.length > 0) { @@ -86,16 +88,16 @@ export class ThemeService implements IThemeService { }); } - public loadThemeCSS(themeId: string): TPromise { - return this.getTheme(themeId).then(theme => { + public applyThemeCSS(themeId: string): TPromise { + return this.loadTheme(themeId).then(theme => { if (theme) { - return loadTheme(theme); + return applyTheme(theme); } return null; }); } - public getThemes(): TPromise { + public getThemes(): TPromise { return this.pluginService.onReady().then(isReady => { return this.knownThemes; }); @@ -141,7 +143,7 @@ function toCssSelector(str: string) { return str.replace(/[^_\-a-zA-Z0-9]/g, '-'); } -function loadTheme(theme: ITheme): TPromise { +function applyTheme(theme: IThemeData): TPromise { if (theme.styleSheetContent) { _applyRules(theme.styleSheetContent); }