本文整理汇总了TypeScript中vs/base/common/color.Color类的典型用法代码示例。如果您正苦于以下问题:TypeScript Color类的具体用法?TypeScript Color怎么用?TypeScript Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Color类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test('isLighterColor', () => {
let color1 = new Color(new HSLA(60, 1, 0.5, 1)), color2 = new Color(new HSLA(0, 0, 0.753, 1));
assert.ok(color1.isLighterThan(color2));
// Abyss theme
assert.ok(Color.fromHex('#770811').isLighterThan(Color.fromHex('#000c18')));
});
开发者ID:donaldpipowitch,项目名称:vscode,代码行数:8,代码来源:color.test.ts
示例2: test
test('getLighterColor', function () {
let color1 = new Color(new HSLA(60, 1, 0.5, 1)), color2 = new Color(new HSLA(0, 0, 0.753, 1));
assert.deepEqual(color1.hsla, Color.getLighterColor(color1, color2).hsla);
assert.deepEqual(new HSLA(0, 0, 0.916, 1), Color.getLighterColor(color2, color1).hsla);
assert.deepEqual(new HSLA(0, 0, 0.851, 1), Color.getLighterColor(color2, color1, 0.3).hsla);
assert.deepEqual(new HSLA(0, 0, 0.981, 1), Color.getLighterColor(color2, color1, 0.7).hsla);
assert.deepEqual(new HSLA(0, 0, 1, 1), Color.getLighterColor(color2, color1, 1).hsla);
});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:10,代码来源:color.test.ts
示例3: extractColor
public extractColor(offsetX: number, offsetY: number): Color {
const opacityX = 1 - (offsetX / this.domNode.offsetWidth);
const opacityY = offsetY / this.domNode.offsetHeight;
const whiteGradientColor = Color.fromRGBA(new RGBA(255, 255, 255, opacityX * 255));
const blackGradientColor = Color.fromRGBA(new RGBA(0, 0, 0, opacityY * 255));
const gradientsMix = blackGradientColor.blend(whiteGradientColor);
return gradientsMix.blend(this.calculateHueColor(this.model.hue));
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:10,代码来源:colorPickerBody.ts
示例4: WORKBENCH_BACKGROUND
export function WORKBENCH_BACKGROUND(theme: ITheme): Color {
switch (theme.type) {
case 'dark':
return Color.fromHex('#252526');
case 'light':
return Color.fromHex('#F3F3F3');
default:
return Color.fromHex('#000000');
}
}
开发者ID:ramesius,项目名称:vscode,代码行数:10,代码来源:theme.ts
示例5: opacity
public set opacity(opacity: number) {
this._opacity = opacity;
const rgba = this._color.toRGBA();
this.color = Color.fromRGBA(new RGBA(rgba.r, rgba.g, rgba.b, opacity * 255));
if (this.widget.header) {
this.widget.header.updatePickedColor();
}
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:10,代码来源:colorPickerModel.ts
示例6: applyStyles
protected applyStyles(): void {
if (this.selectElement) {
const background = this.selectBackground ? this.selectBackground.toString() : null;
const foreground = this.selectForeground ? this.selectForeground.toString() : null;
const border = this.selectBorder ? this.selectBorder.toString() : null;
this.selectElement.style.backgroundColor = background;
this.selectElement.style.color = foreground;
this.selectElement.style.borderColor = border;
}
}
开发者ID:SeanKilleen,项目名称:vscode,代码行数:11,代码来源:selectBox.ts
示例7: test
test('getDarkerColor', function () {
let color1 = Color.fromHSLA(new HSLA(60, 1, 0.5, 1)), color2 = Color.fromHSLA(new HSLA(0, 0, 0.753, 1));
assert.deepEqual(color2.toHSLA(), Color.getDarkerColor(color2, color1).toHSLA());
assert.deepEqual(new HSLA(60, 1, 0.392, 1), Color.getDarkerColor(color1, color2).toHSLA());
assert.deepEqual(new HSLA(60, 1, 0.435, 1), Color.getDarkerColor(color1, color2, 0.3).toHSLA());
assert.deepEqual(new HSLA(60, 1, 0.349, 1), Color.getDarkerColor(color1, color2, 0.7).toHSLA());
assert.deepEqual(new HSLA(60, 1, 0.284, 1), Color.getDarkerColor(color1, color2, 1).toHSLA());
// Abyss theme
assert.deepEqual(new HSLA(355, 0.874, 0.157, 1), Color.getDarkerColor(Color.fromHex('#770811'), Color.fromHex('#000c18'), 0.4).toHSLA());
});
开发者ID:m-khosravi,项目名称:vscode,代码行数:12,代码来源:color.test.ts
示例8: test
test('getDarkerColor', function () {
let color1 = Color.fromHSLA({ h: 60, s: 1, l: 0.5, a: 1 }), color2 = Color.fromHSLA({ h: 0, s: 0, l: 0.753, a: 1 });
assert.deepEqual(color2.toHSLA(), Color.getDarkerColor(color2, color1).toHSLA());
assert.deepEqual({ h: 60, s: 1, l: 0.392, a: 1 }, Color.getDarkerColor(color1, color2).toHSLA());
assert.deepEqual({ h: 60, s: 1, l: 0.435, a: 1 }, Color.getDarkerColor(color1, color2, 0.3).toHSLA());
assert.deepEqual({ h: 60, s: 1, l: 0.349, a: 1 }, Color.getDarkerColor(color1, color2, 0.7).toHSLA());
assert.deepEqual({ h: 60, s: 1, l: 0.284, a: 1 }, Color.getDarkerColor(color1, color2, 1).toHSLA());
// Abyss theme
assert.deepEqual({ h: 355, s: 0.874, l: 0.157, a: 1 }, Color.getDarkerColor(Color.fromHex('#770811'), Color.fromHex('#000c18'), 0.4).toHSLA());
});
开发者ID:GYGit,项目名称:vscode,代码行数:12,代码来源:color.test.ts
示例9: applyStyles
private applyStyles(): void {
if (this.$el) {
const background = this.buttonBackground ? this.buttonBackground.toString() : null;
const foreground = this.buttonForeground ? this.buttonForeground.toString() : null;
this.$el.style('color', foreground);
this.$el.style('background-color', background);
}
}
开发者ID:wangcheng678,项目名称:vscode,代码行数:9,代码来源:button.ts
示例10: applyStyles
private applyStyles(): void {
if (this.$el) {
const background = this.buttonBackground ? this.buttonBackground.toString() : null;
const foreground = this.buttonForeground ? this.buttonForeground.toString() : null;
const border = this.buttonBorder ? this.buttonBorder.toString() : null;
this.$el.style('color', foreground);
this.$el.style('background-color', background);
this.$el.style('border-width', border ? '1px' : null);
this.$el.style('border-style', border ? 'solid' : null);
this.$el.style('border-color', border);
}
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:14,代码来源:button.ts
注:本文中的vs/base/common/color.Color类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论