Graphics-ColorPicker

 view release on metacpan or  search on metacpan

ColorPicker.pm  view on Meta::CPAN

  if ( ckhex(s) ) { 
    hex = s;
    setrgb();
    update();
  }
}
function newco(i,c) {
  var newcolor = document.forms.rgb[clr[c]];
  var n = newcolor.value;
  if (n == '') return false;
  if (isNaN(n)) {
    alert(color[c] + ' is not a number');
    newcolor.value = "";
    return false;
  }
  if ( n < 0 | . '||' . q| n > 255 ) {
    alert(color[c] + " out of range\nmust be 0-255");
    newcolor.value = "";
    return false;
  }
  n = Number(n) + Number(i);
  if ( n < 0 ) n = 0;
  if ( n > 255 ) n = 255;
  if ( rgb[c] != n ) {
    rgb[c] = n;
    newcolor.value = n;
    sethex();
  }
  return false; // always!
}
function sethex() {
  if (isNaN(rgb[0]) | .'||'. q| isNaN(rgb[1]) | .'||'. q|isNaN(rgb[2])) return false;
  hex = "" + tohex(rgb[0]) + tohex(rgb[1]) + tohex(rgb[2]);
  document.forms.rgb.hex.value = hex;
  update();
}
function tohex(n) {
  var h = "" + hexd[n>>4] + hexd[n%16];
  return h;
}
function clrupd() {
  document.forms.rgb.r.blur();

ColorPicker.pm  view on Meta::CPAN

  if ( ! skip ) {
    var xy = window._data.document.location.search;
    var qloc = xy.lastIndexOf('?') + 1;
    var cloc = xy.lastIndexOf(',');
    px = bound(xy.substring(qloc,cloc));
    py = bound(xy.substring(cloc+1,xy.length));
  }
}
bound = function(n) {
  n = 0 + n;
  if (isNaN(n)) return 0;
  if (n < 0) n = 0;
  return n;
}
setcolor = function(r,g,b) {
  with (window._digits) {
  rgb[0] = r;
  rgb[1] = g;
  rgb[2] = b;
  setrgb();  
  sethex();



( run in 0.370 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )