UNPKG
lib-colors
Version:
latest (0.2.1)
0.2.1
0.2.0
0.1.1
0.1.0
0.0.2
0.0.1
Simple node.js library for work with colors
github.com/fwmakc/lib-colors
fwmakc/lib-colors
lib-colors
/
src
/
hsl
/
helpers
/
hsl_to_string.helper.ts
11 lines
(7 loc)
•
305 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
import
{ alphaIsSet }
from
'../../helpers/alpha_is_set.helper'
;
import
type
{
IHSL
}
from
'../hsl.interface'
;
export
function
hslToString
(
hsl
: IHSL
):
string
{
const
{ h, s, l, a } = { ...hsl };
const
aValue =
alphaIsSet
(a) ?
` /
${a}
`
:
''
;
return
`hsl(
${h}
,
${s}
%,
${l}
%
${aValue}
)`
; }