From 981269960b6d8ce4b8c6e4da7f5979e2f7eea231 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 7 Jan 2014 00:09:50 -0500 Subject: black() white() red() --- instructions.html | 7 +++++-- js/color.js | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/instructions.html b/instructions.html index 32474cf..ef84503 100644 --- a/instructions.html +++ b/instructions.html @@ -40,8 +40,11 @@ rand(n), randint(n) choice(array) deg(radians), rad(degrees) -color functions -rgb(x,y,z) (setter) +set pixel color +rgb(r,g,b) +black() white() red() + +color spaces rgb2xyz(rgb) xyz2rgb(xyz) xyz2hunterlab(xyz) diff --git a/js/color.js b/js/color.js index 34404cd..d51bb67 100644 --- a/js/color.js +++ b/js/color.js @@ -4,6 +4,9 @@ function rgb(x,y,z){ if (x.length) { r=x[0]; g=x[1]; b =x[2]; } else { r=x; g=y; b=z } } +function black(){ rgb(0,0,0) } +function white(){ rgb(255,255,255) } +function red(){ rgb(255,0,0) } function rgb2xyz(rgb){ var var_R = ( rgb[0] / 255 ) //R from 0 to 255 -- cgit v1.2.3-70-g09d2