diff options
Diffstat (limited to 'node_modules/chroma-js/src/conversions/clip_rgb.coffee')
-rw-r--r-- | node_modules/chroma-js/src/conversions/clip_rgb.coffee | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/node_modules/chroma-js/src/conversions/clip_rgb.coffee b/node_modules/chroma-js/src/conversions/clip_rgb.coffee new file mode 100644 index 0000000000..442e959083 --- /dev/null +++ b/node_modules/chroma-js/src/conversions/clip_rgb.coffee @@ -0,0 +1,10 @@ + +clip_rgb = (rgb) -> + for i of rgb + if i < 3 + rgb[i] = 0 if rgb[i] < 0 + rgb[i] = 255 if rgb[i] > 255 + else if i == 3 + rgb[i] = 0 if rgb[i] < 0 + rgb[i] = 1 if rgb[i] > 1 + rgb |