UNPKG

1.32 kBSource Map (JSON)View Raw
1{"version":3,"file":"updateH.js","sourceRoot":"../src/","sources":["utilities/color/updateH.ts"],"names":[],"mappings":";;;;AAAA,qCAAoC;AACpC,qCAAoC;AACpC,uDAAsD;AAGtD;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,KAAa,EAAE,CAAS;IACxC,IAAA,KAAc,iBAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAxC,CAAC,OAAA,EAAE,CAAC,OAAA,EAAE,CAAC,OAAiC,CAAC;IACjD,IAAM,GAAG,GAAG,iBAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE7B,6CACK,KAAK,KACR,CAAC,GAAA,EACD,CAAC,GAAA,EACD,CAAC,GAAA,EACD,CAAC,GAAA,EACD,GAAG,KAAA,EACH,GAAG,EAAE,mCAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAC5C;AACJ,CAAC;AAbD,0BAaC","sourcesContent":["import { hsv2rgb } from './hsv2rgb';\nimport { rgb2hex } from './rgb2hex';\nimport { _rgbaOrHexString } from './_rgbaOrHexString';\nimport type { IColor } from './interfaces';\n\n/**\n * Gets a color with the same saturation and value as `color` and the other components updated\n * to match the given hue.\n *\n * Does not modify the original `color` and does not supply a default alpha value.\n */\nexport function updateH(color: IColor, h: number): IColor {\n const { r, g, b } = hsv2rgb(h, color.s, color.v);\n const hex = rgb2hex(r, g, b);\n\n return {\n ...color,\n h,\n r,\n g,\n b,\n hex,\n str: _rgbaOrHexString(r, g, b, color.a, hex),\n };\n}\n"]}
\No newline at end of file