UNPKG
chromatism
Version:
latest (3.0.0)
3.0.0
2.6.0
2.5.8
2.5.7
2.5.6
2.5.5
2.5.4
2.5.3
2.5.2
2.5.1
2.5.0
2.4.4
2.4.3
2.4.2
2.4.1
2.4.0
2.3.2
2.3.1
2.3.0
2.2.1
2.2.0
2.1.0
2.0.1
2.0.0
1.11.0
1.10.0
1.9.1
1.9.0
1.8.1
1.8.0
1.7.1
1.7.0
1.6.0
1.5.1
1.5.0
1.4.1
1.4.0
1.3.1
1.3.0
1.2.0
A simple set of utility functions for colours.
github.com/toish/chromatism
toish/chromatism
chromatism
/
src
/
helpers
/
bounded-rgb.js
12 lines
(9 loc)
•
222 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import
bounded
from
'./bounded'
const
bounded255
= val =>
bounded
(val, [
0
,
255
])
export
default
function
boundedRgb
(
rgb
) {
return
{
r
:
bounded255
(rgb.
r
),
g
:
bounded255
(rgb.
g
),
b
:
bounded255
(rgb.
b
) } }