引入
ts
import { rgb2hsv, hsv2rgb } from 't-comm';
// 不支持 tree-shaking 的项目
import { rgb2hsv, hsv2rgb} from 't-comm/lib/color/index';
// 只支持 ESM 的项目
import { rgb2hsv, hsv2rgb} from 't-comm/es/color/index';
rgb2hsv()
描述:
Converts an RGB color value to HSV Assumes: r, g, and b are contained in the set [0, 255] or [0, 1]. Returns: { h, s, v } in [0,1]
参数:
hsv2rgb()
描述:
Converts an HSV color value to RGB. Assumes: h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]. Returns: { r, g, b } in the set [0, 255]
参数: