1 | {"version":3,"file":"getColorFromHSV.js","sourceRoot":"../src/","sources":["utilities/color/getColorFromHSV.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAC3C,qCAAoC;AACpC,qCAAoC;AACpC,uDAAsD;AAGtD;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,GAAS,EAAE,CAAU;IAC3C,IAAA,CAAC,GAAW,GAAG,EAAd,EAAE,CAAC,GAAQ,GAAG,EAAX,EAAE,CAAC,GAAK,GAAG,EAAR,CAAS;IACxB,CAAC,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAe,CAAC;IAE1C,IAAA,KAAc,iBAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAA5B,CAAC,OAAA,EAAE,CAAC,OAAA,EAAE,CAAC,OAAqB,CAAC;IACrC,IAAM,GAAG,GAAG,iBAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,IAAM,GAAG,GAAG,mCAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,IAAM,CAAC,GAAG,wBAAe,GAAG,CAAC,CAAC;IAE9B,OAAO,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,GAAG,KAAA,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,GAAG,KAAA,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC;AAC9C,CAAC;AAVD,0CAUC","sourcesContent":["import { MAX_COLOR_ALPHA } from './consts';\nimport { hsv2rgb } from './hsv2rgb';\nimport { hsv2hex } from './hsv2hex';\nimport { _rgbaOrHexString } from './_rgbaOrHexString';\nimport type { IHSV, IColor } from './interfaces';\n\n/**\n * Converts an HSV color (and optional alpha value) to a color object.\n * If `a` is not given, a default of 100 is used.\n * Hex in the returned value will *not* be prefixed with #.\n * If `a` is unspecified or 100, the result's `str` property will contain a hex value\n * (*not* prefixed with #)\n */\nexport function getColorFromHSV(hsv: IHSV, a?: number): IColor {\n const { h, s, v } = hsv;\n a = typeof a === 'number' ? a : MAX_COLOR_ALPHA;\n\n const { r, g, b } = hsv2rgb(h, s, v);\n const hex = hsv2hex(h, s, v);\n const str = _rgbaOrHexString(r, g, b, a, hex);\n const t = MAX_COLOR_ALPHA - a;\n\n return { a, b, g, h, hex, r, s, str, v, t };\n}\n"]} |