/* Copyright 2010 by Robin W. Spencer This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You can find a copy of the GNU General Public License at http://www.gnu.org/licenses/. */ function HSVtoRGB(h,s,v,opacity){ // inputs h=hue=0-360, s=saturation=0-1, v=value=0-1 // algorithm from Wikipedia on HSV conversion var toHex=function(decimalValue,places){ if(places == undefined || isNaN(places)) places = 2; var hex = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"); var next = 0; var hexidecimal = ""; decimalValue=Math.floor(decimalValue); while(decimalValue > 0){ next = decimalValue % 16; decimalValue = Math.floor((decimalValue - next)/16); hexidecimal = hex[next] + hexidecimal; } while (hexidecimal.length