From 43160efc081d809d6a87f161e35d43da4337d16c Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Fri, 11 Aug 2017 11:19:34 +0200 Subject: [PATCH] Color alpha isn't optional --- src/vs/workbench/api/node/extHostTypes.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index cc6ac5c91a7..0c578ad3ddb 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -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); } }