本文整理汇总了TypeScript中external/gs_tools/src/color.HslColor类的典型用法代码示例。如果您正苦于以下问题:TypeScript HslColor类的具体用法?TypeScript HslColor怎么用?TypeScript HslColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HslColor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: createShade_
/**
* @param base Base color.
* @param value Proportion of shade. 0 means totally dark, 1 means totally bright.
* @param reverseMode If true, saturation === value. Otherwise, saturation === 1 - value.
* @return The shade color.
*/
private static createShade_(base: Color, value: number, reverseMode: boolean): Color {
const cappedValue = Math.min(Math.max(value, 0), 1);
return HslColor.newInstance(
base.getHue(),
(reverseMode ? cappedValue : 1 - cappedValue) * base.getSaturation(),
cappedValue);
}
开发者ID:garysoed,项目名称:gs-ui,代码行数:13,代码来源:theme.ts
示例2:
import { Colors, HslColor } from 'external/gs_tools/src/color';
import { OrderedMap } from 'external/gs_tools/src/immutable';
import { Color } from 'external/gs_tools/src/interfaces';
const COLOR_MAP: OrderedMap<string, Color> = OrderedMap.of([
['red', HslColor.newInstance(0, 1, 0.5)],
['scarlet', HslColor.newInstance(7.5, 1, 0.5)],
['vermilion', HslColor.newInstance(15, 1, 0.5)],
['blazeorange', HslColor.newInstance(22.5, 1, 0.5)],
['flushorange', HslColor.newInstance(30, 1, 0.5)],
['orangepeel', HslColor.newInstance(37.5, 1, 0.5)],
['amber', HslColor.newInstance(45, 1, 0.5)],
['schoolbusyellow', HslColor.newInstance(52.5, 1, 0.5)],
['yellow', HslColor.newInstance(60, 1, 0.5)],
['chartreuse', HslColor.newInstance(82.5, 1, 0.5)],
['harlequin', HslColor.newInstance(105, 1, 0.5)],
['green', HslColor.newInstance(127.5, 1, 0.5)],
['springgreen', HslColor.newInstance(150, 1, 0.5)],
['aqua', HslColor.newInstance(172.5, 1, 0.5)],
['cerulean', HslColor.newInstance(195, 1, 0.5)],
['blueribbon', HslColor.newInstance(217.5, 1, 0.5)],
['blue', HslColor.newInstance(240, 1, 0.5)],
['blueviolet', HslColor.newInstance(255, 1, 0.5)],
['electricviolet', HslColor.newInstance(270, 1, 0.5)],
['violet', HslColor.newInstance(285, 1, 0.5)],
['magenta', HslColor.newInstance(300, 1, 0.5)],
['purplepizzazz', HslColor.newInstance(315, 1, 0.5)],
['rose', HslColor.newInstance(330, 1, 0.5)],
['torchred', HslColor.newInstance(345, 1, 0.5)],
['grey', HslColor.newInstance(0, 0, 0.5)],
开发者ID:garysoed,项目名称:gs-ui,代码行数:31,代码来源:default-palettes.ts
示例3: it
it('should cap negative value to 0', () => {
const hue = 123;
const baseColor = HslColor.newInstance(hue, 0.5, 0.5);
const shade = Theme['createShade_'](baseColor, -0.5, false);
assertColor(shade).to.haveHsl(hue, 0.5, 0);
});
开发者ID:garysoed,项目名称:gs-ui,代码行数:6,代码来源:theme_test.ts
注:本文中的external/gs_tools/src/color.HslColor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论