# All files / internalHelpers _hslToHex.js

100% Statements 3/3
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20

    99x

    33x

    33x

     // @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, green, blue) {
      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