mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Color alpha isn't optional
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import * as crypto from 'crypto';
|
||||
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { Color as CommonColor, HSLA } from 'vs/base/common/color';
|
||||
import { Color as BaseColor, HSLA } from 'vs/base/common/color';
|
||||
import { illegalArgument } from 'vs/base/common/errors';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
@@ -1020,23 +1020,20 @@ export class Color {
|
||||
readonly blue: number;
|
||||
readonly alpha: number;
|
||||
|
||||
constructor(red: number, green: number, blue: number, alpha?: number) {
|
||||
constructor(red: number, green: number, blue: number, alpha: number) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
static fromHSLA(hue: number, saturation: number, luminosity: number, alpha?: number): Color {
|
||||
if (!alpha) {
|
||||
alpha = 1;
|
||||
}
|
||||
const color = new CommonColor(new HSLA(hue, saturation, luminosity, alpha)).rgba;
|
||||
static fromHSLA(hue: number, saturation: number, luminance: number, alpha: number): Color {
|
||||
const color = new BaseColor(new HSLA(hue, saturation, luminance, alpha)).rgba;
|
||||
return new Color(color.r, color.g, color.b, color.a / 255);
|
||||
}
|
||||
|
||||
static fromHex(hex: string): Color {
|
||||
const color = CommonColor.fromHex(hex).rgba;
|
||||
const color = BaseColor.fromHex(hex).rgba;
|
||||
return new Color(color.r, color.g, color.b, color.a / 255);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user