Monaco API uses IColor

This commit is contained in:
rebornix
2017-08-23 13:40:29 -07:00
committed by Peng Lyu
parent c71a78cff8
commit 580eb6b4b2
9 changed files with 123 additions and 39 deletions

View File

@@ -58,15 +58,12 @@ export class ColorProvider implements DocumentColorProvider {
for (let range of ranges) {
let color;
const value = document.getText(range);
if (value[0] === '#') {
color = Color.fromHex(value);
} else {
const parsedColor = parse(value);
if (parsedColor && parsedColor.rgba) {
const [red, green, blue, alpha] = parsedColor.rgba;
color = new Color(red, green, blue, alpha);
}
const parsedColor = parse(value);
if (parsedColor && parsedColor.rgba) {
const [red, green, blue, alpha] = parsedColor.rgba;
color = new Color(red, green, blue, alpha);
}
if (color) {
result.push(new ColorRange(range, color, [CSSColorFormats.Hex, CSSColorFormats.RGB, CSSColorFormats.HSL]));
}