Skip to content

Commit

Permalink
feat: support property ThemeColor id
Browse files Browse the repository at this point in the history
  • Loading branch information
quxingkai committed Jan 3, 2025
1 parent 7b8b351 commit 24a8e8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/extension/src/common/vscode/ext-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ export enum TextEditorLineNumbersStyle {

@es5ClassCompat
export class ThemeColor {
id: string;
readonly id: string;
constructor(id: string) {
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class StatusBarItemImpl implements vscode.StatusBarItem {
private _tooltip?: string | vscode.MarkdownString;
private _name?: string;
private _color: string | ThemeColor | undefined;
private _backgroundColor: string | ThemeColor | undefined;
private _backgroundColor: ThemeColor | undefined;
private _command: string | vscode.Command | undefined;

private _isVisible: boolean;
Expand Down Expand Up @@ -148,11 +148,11 @@ export class StatusBarItemImpl implements vscode.StatusBarItem {
this.update();
}

public get backgroundColor(): string | ThemeColor | undefined {
public get backgroundColor(): ThemeColor | undefined {
return this._backgroundColor;
}

public set backgroundColor(color: string | ThemeColor | undefined) {
public set backgroundColor(color: ThemeColor | undefined) {
if (!color) {
color = undefined;
} else if (isString(color)) {
Expand Down
5 changes: 5 additions & 0 deletions packages/types/vscode/typings/vscode.theme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ declare module 'vscode' {
* Using a theme color is preferred over a custom color as it gives theme authors and users the possibility to change the color.
*/
export class ThemeColor {
/**
* The id of this color.
*/
readonly id: string;

/**
* Creates a reference to a theme color.
* @param id of the color. The available colors are listed in https://code.visualstudio.com/docs/getstarted/theme-color-reference.
Expand Down

0 comments on commit 24a8e8d

Please sign in to comment.