summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjules <jules@okfoc.us>2014-01-07 00:39:10 -0500
committerjules <jules@okfoc.us>2014-01-07 00:39:10 -0500
commit3e23b012c1f4b1b438e27a57dd05aa82a0314d3c (patch)
treed3c32b12278a24157a79ba0c2ac64d68b72395ca
parent8b8e15557e8e8199eabfccc205824f027bcd3f6a (diff)
gray(n)
-rw-r--r--instructions.html1
-rw-r--r--js/color.js1
2 files changed, 2 insertions, 0 deletions
diff --git a/instructions.html b/instructions.html
index 4ff57e9..2767e48 100644
--- a/instructions.html
+++ b/instructions.html
@@ -44,6 +44,7 @@ deg(radians), rad(degrees)
rgb(r,g,b)
rgbref([rgb])
black() white() red()
+gray(n)
<u>color spaces</u>
rgb2xyz(rgb)
diff --git a/js/color.js b/js/color.js
index da4f430..ba60db7 100644
--- a/js/color.js
+++ b/js/color.js
@@ -9,6 +9,7 @@ function rgbref(rgb){
function black(){ rgb(0,0,0) }
function white(){ rgb(255,255,255) }
function red(){ rgb(255,0,0) }
+function gray(n){ n<1&&(n*=255);rgb(n,n,n) }
function rgb2xyz(rgb){
var var_R = ( rgb[0] / 255 ) //R from 0 to 255