since category since export interface Hex { readonly _tag : 'Hex' ; /**
     * The hexadecimal value of a color.
     */ readonly value : string ; } category since export interface Hsla { readonly _tag : 'Hsla' ; /**
     * A number between `0` and `360` representing the hue of the color in degrees.
     */ readonly h : number ; /**
     * A number between `0` and `1` representing the percent saturation of the color
     * where `0` is completely denatured (grayscale) and `1` is fully saturated (full color).
     */ readonly s : number ; /**
     * A number between `0` and `1` representing the percent lightness of the color
     * where `0` is completely dark (black) and `1` is completely light (white).
     */ readonly l : number ; /**
     * A number between `0` and `1` representing the opacity or transparency of the color
     * where `0` is fully transparent and `1` is fully opaque.
     */ readonly a : number ; } category since export type Color = Hex | Hsla ; category since export const hex = ( value ) => ( { _tag : 'Hex' , value } ) ; category since export const hsla = ( h , s , l , a ) => ( { _tag : 'Hsla' , h , s , l , a } ) ; category since export const hsl = ( h , s , l ) => hsla ( h , s , l , 1 ) ; category since export const black = hsl ( 0 , 0 , 0 ) ; category since export const white = hsl ( 360 , 1 , 1 ) ; category since export const toCss = ( c ) => { switch ( c . _tag ) { case 'Hex' : return c . value ; case 'Hsla' : { const { h , s , l , a } = c ; const toString = ( n ) : number => Math . round ( n * 100.0 ) / 100 ; const hue = toString ( h ) ; const saturation = toString ( s * 100.0 ) + '%' ; const lightness = toString ( l * 100.0 ) + '%' ; const alpha = String ( a ) ; return a === 1 ? `hsl(${ hue }, ${ saturation }, ${ lightness })` : `hsla(${ hue }, ${ saturation }, ${ lightness }, ${ alpha })` ; } } } ;