Skip to content

Commit

Permalink
Merge pull request #84497 from microsoft/aeschli/tokenScopes
Browse files Browse the repository at this point in the history
First cut theming support for semantic colors
  • Loading branch information
aeschli committed Nov 11, 2019
2 parents dfe469f + 9365004 commit 587e25c
Show file tree
Hide file tree
Showing 16 changed files with 1,208 additions and 42 deletions.
5 changes: 3 additions & 2 deletions extensions/theme-abyss/themes/abyss-color-theme.json
Expand Up @@ -252,6 +252,9 @@
],
"colors": {

"editor.background": "#000c18",
"editor.foreground": "#6688cc",

// Base
// "foreground": "",
"focusBorder": "#596F99",
Expand Down Expand Up @@ -295,8 +298,6 @@
"scrollbarSlider.hoverBackground": "#3B3F5188",

// Editor
"editor.background": "#000c18",
// "editor.foreground": "#6688cc",
"editorWidget.background": "#262641",
"editorCursor.foreground": "#ddbb88",
"editorWhitespace.foreground": "#103050",
Expand Down
10 changes: 10 additions & 0 deletions src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts
Expand Up @@ -14,6 +14,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { Registry } from 'vs/platform/registry/common/platform';
import { ColorIdentifier, Extensions, IColorRegistry } from 'vs/platform/theme/common/colorRegistry';
import { Extensions as ThemingExtensions, ICssStyleCollector, IIconTheme, IThemingRegistry } from 'vs/platform/theme/common/themeService';
import { TokenStyle, TokenClassification, ProbeScope } from 'vs/platform/theme/common/tokenClassificationRegistry';

const VS_THEME_NAME = 'vs';
const VS_DARK_THEME_NAME = 'vs-dark';
Expand All @@ -23,6 +24,7 @@ const colorRegistry = Registry.as<IColorRegistry>(Extensions.ColorContribution);
const themingRegistry = Registry.as<IThemingRegistry>(ThemingExtensions.ThemingContribution);

class StandaloneTheme implements IStandaloneTheme {

public readonly id: string;
public readonly themeName: string;

Expand Down Expand Up @@ -128,6 +130,14 @@ class StandaloneTheme implements IStandaloneTheme {
}
return this._tokenTheme;
}

getTokenStyle(classification: TokenClassification, useDefault?: boolean | undefined): TokenStyle | undefined {
return undefined;
}

resolveScopes(scopes: ProbeScope[]): TokenStyle | undefined {
return undefined;
}
}

function isBuiltinTheme(themeName: string): themeName is BuiltinTheme {
Expand Down
Expand Up @@ -54,7 +54,11 @@ suite('TokenizationSupport2Adapter', () => {

defines: (color: ColorIdentifier): boolean => {
throw new Error('Not implemented');
}
},

getTokenStyle: () => undefined,
resolveScopes: () => undefined

};
}
public getIconTheme(): IIconTheme {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/theme/common/colorRegistry.ts
Expand Up @@ -103,7 +103,7 @@ class ColorRegistry implements IColorRegistry {
public registerColor(id: string, defaults: ColorDefaults | null, description: string, needsTransparency = false, deprecationMessage?: string): ColorIdentifier {
let colorContribution: ColorContribution = { id, description, defaults, needsTransparency, deprecationMessage };
this.colorsById[id] = colorContribution;
let propertySchema: IJSONSchema = { type: 'string', description, format: 'color-hex', defaultSnippets: [{ body: '#ff0000' }] };
let propertySchema: IJSONSchema = { type: 'string', description, format: 'color-hex', defaultSnippets: [{ body: '${1:#ff0000}' }] };
if (deprecationMessage) {
propertySchema.deprecationMessage = deprecationMessage;
}
Expand Down
5 changes: 5 additions & 0 deletions src/vs/platform/theme/common/themeService.ts
Expand Up @@ -10,6 +10,7 @@ import * as platform from 'vs/platform/registry/common/platform';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
import { Event, Emitter } from 'vs/base/common/event';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { TokenStyle, TokenClassification, ProbeScope } from 'vs/platform/theme/common/tokenClassificationRegistry';

export const IThemeService = createDecorator<IThemeService>('themeService');

Expand Down Expand Up @@ -59,6 +60,10 @@ export interface ITheme {
* default color will be used.
*/
defines(color: ColorIdentifier): boolean;

getTokenStyle(classification: TokenClassification, useDefault?: boolean): TokenStyle | undefined;

resolveScopes(scopes: ProbeScope[]): TokenStyle | undefined;
}

export interface IIconTheme {
Expand Down

0 comments on commit 587e25c

Please sign in to comment.