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
/
dist
/
gray
/
helpers
/
gray_to_rgb.helper.js
14 lines
(13 loc)
•
323 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
, {
value
:
true
});
exports
.
grayToRgb
= grayToRgb;
function
grayToRgb
(
gray
) {
const
{ g, a } = { ...gray };
const
grayscale =
Math
.
round
((g /
100
) *
256
) -
1
;
return
{
r
: grayscale,
g
: grayscale,
b
: grayscale, a, }; }