mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Added ColorMode to API.
This commit is contained in:
@@ -492,6 +492,7 @@ export function createApiFactory(
|
||||
CodeLens: extHostTypes.CodeLens,
|
||||
Color: extHostTypes.Color,
|
||||
ColorInfo: extHostTypes.ColorInfo,
|
||||
ColorMode: extHostTypes.ColorMode,
|
||||
EndOfLine: extHostTypes.EndOfLine,
|
||||
CompletionItem: extHostTypes.CompletionItem,
|
||||
CompletionItemKind: extHostTypes.CompletionItemKind,
|
||||
|
||||
@@ -35,7 +35,7 @@ import { IConfigurationData } from 'vs/platform/configuration/common/configurati
|
||||
import { IPickOpenEntry, IPickOptions } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
|
||||
import { EndOfLine, TextEditorLineNumbersStyle } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { EndOfLine, TextEditorLineNumbersStyle, ColorMode } from 'vs/workbench/api/node/extHostTypes';
|
||||
|
||||
|
||||
import { TaskSet } from 'vs/workbench/parts/tasks/common/tasks';
|
||||
@@ -456,6 +456,7 @@ export abstract class ExtHostHeapServiceShape {
|
||||
|
||||
export interface IColorInfo {
|
||||
color: [number, number, number, number | undefined];
|
||||
mode: ColorMode;
|
||||
range: IRange;
|
||||
}
|
||||
|
||||
|
||||
@@ -374,6 +374,7 @@ export namespace DocumentColor {
|
||||
export function from(colorInfo: vscode.ColorInfo): IColorInfo {
|
||||
return {
|
||||
color: [colorInfo.color.red, colorInfo.color.green, colorInfo.color.blue, colorInfo.color.alpha],
|
||||
mode: <number>colorInfo.mode,
|
||||
range: fromRange(colorInfo.range)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1043,20 +1043,32 @@ export class Color {
|
||||
}
|
||||
}
|
||||
|
||||
export enum ColorMode {
|
||||
RGBA = 0,
|
||||
Hex = 1,
|
||||
HSLA = 2
|
||||
}
|
||||
|
||||
export class ColorInfo {
|
||||
range: Range;
|
||||
|
||||
color: Color;
|
||||
|
||||
constructor(color: Color, range: Range) {
|
||||
mode: ColorMode;
|
||||
|
||||
constructor(range: Range, color: Color, mode: ColorMode) {
|
||||
if (color && !(color instanceof Color)) {
|
||||
throw illegalArgument('target');
|
||||
throw illegalArgument('color');
|
||||
}
|
||||
if (mode && !(mode in ColorMode)) {
|
||||
throw illegalArgument('mode');
|
||||
}
|
||||
if (!Range.isRange(range) || range.isEmpty) {
|
||||
throw illegalArgument('range');
|
||||
}
|
||||
this.range = range;
|
||||
this.color = color;
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user