Here is a color calculator I adapted from a friend’s PHP implementation: Color = function() { }; Color.hexdec = function(hex_string) { hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, ''); return parseInt(hex_string, 16); } Color.dechex = function(number) { if (number < 0) { number = 0xFFFFFFFF + number + 1; } return parseInt(number, […]
color
Here is a simple Javascript class to calculate the percent of a gradient between two colors given the percent (as a float 0-1) and two colors. Uses functions from php.js. Color = function() { }; Color.hexdec = function(hex_string) { hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, ''); return parseInt(hex_string, 16); } Color.dechex […]