Files
Shifted/node_modules/polished/lib/internalHelpers/_hslToHex.js.flow
2026-02-10 01:14:19 +00:00

19 lines
545 B
Plaintext

// @flow
import hslToRgb from './_hslToRgb'
import reduceHexValue from './_reduceHexValue'
import toHex from './_numberToHex'
function colorToHex(color: number): string {
return toHex(Math.round(color * 255))
}
function convertToHex(red: number, green: number, blue: number): string {
return reduceHexValue(`#${colorToHex(red)}${colorToHex(green)}${colorToHex(blue)}`)
}
function hslToHex(hue: number, saturation: number, lightness: number): string {
return hslToRgb(hue, saturation, lightness, convertToHex)
}
export default hslToHex