本文整理汇总了TypeScript中vs/editor/contrib/colorPicker/common/colorFormatter.ColorFormatter类的典型用法代码示例。如果您正苦于以下问题:TypeScript ColorFormatter类的具体用法?TypeScript ColorFormatter怎么用?TypeScript ColorFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ColorFormatter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test('no placeholder', () => {
const formatter = new ColorFormatter('hello');
assert.equal(formatter.supportsTransparency, false);
assert.equal(formatter.format(Color.white), 'hello');
assert.equal(formatter.format(Color.transparent), 'hello');
});
开发者ID:pavelfeldman,项目名称:vscode,代码行数:7,代码来源:colorFormatter.test.ts
示例2: color
public set color(color: Color) {
this._color = color;
const alpha = color.toRGBA().a;
if (!this._opacity) {
this._opacity = alpha / 255;
}
this.saturation = color.getSaturation();
this.value = color.getValue();
if (this._opacity === 1) {
this.selectedColorString = this._opaqueFormatter.toString(this._color);
} else if (this._transparentFormatter) {
this.selectedColorString = this._transparentFormatter.toString(this._color);
} else { //no transparent formatter defined for this mode. select another
this.nextColorMode();
}
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:18,代码来源:colorPickerModel.ts
示例3: nextColorMode
public nextColorMode() {
this._colorModelIndex++;
if (this._colorModelIndex === this.colorFormatters.length) {
this._colorModelIndex = 0;
}
const formatter = this.colorFormatters[this._colorModelIndex];
if (isAdvancedFormatter(formatter)) {
this._transparentFormatter = formatter.transparentFormatter;
this._opaqueFormatter = formatter.opaqueFormatter;
this.selectedColorString = this._opacity === 1 ? this._opaqueFormatter.toString(this._color) : this._transparentFormatter.toString(this._color);
} else if (!this._transparentFormatter || this._opacity === 1) {
this._transparentFormatter = null;
this._opaqueFormatter = formatter;
this.selectedColorString = this._opaqueFormatter.toString(this._color);
} else {
this.nextColorMode();
}
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:19,代码来源:colorPickerModel.ts
注:本文中的vs/editor/contrib/colorPicker/common/colorFormatter.ColorFormatter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论