[dev] Fix: Colorpicker javascript error

Cariad Ilmàra cariad at adnx.net
Mon Aug 11 14:34:23 PDT 2003


Hello,

Here's a fix I made for the colorpicker (horde/util/colorpicker.php) to
avoid javascript errors (colours with negative values) with IE.

Triple checked it; and it seems as precise as the old one to me...

Sorry for the other email... I screwed up between the lists... :(

=====================

--- colorpicker.php        2003-08-11 23:09:23.000000000 +0200
+++ colorpicker.php        2003-08-11 23:09:14.000000000 +0200
@@ -87,20 +87,19 @@
          y = y - 160;
          rmax = 255;
          gmax = 0;
-        bmax = 255 - (y / 32.0) * 255;
+        bmax = 255 - (y / 32.0) * 160;
      }

      if (x <= 50) {
          var r = Math.floor(rmax * x / 50.0);
          var g = Math.floor(gmax * x / 50.0);
          var b = Math.floor(bmax * x / 50.0);
-
          return makeColor(r,g,b);
      } else {
          x = x - 50;
-        var r = Math.floor(rmax + (x / 50.0) * (255 - rmax));
-        var g = Math.floor(gmax + (x / 50.0) * (255 - gmax));
-        var b = Math.floor(bmax + (x / 50.0) * (255 - bmax));
+        var r = Math.floor(rmax + (x / 50.0) * (250 - rmax));
+        var g = Math.floor(gmax + (x / 50.0) * (250 - gmax));
+        var b = Math.floor(bmax + (x / 50.0) * (250 - bmax));
          return makeColor(r,g,b);
      }
  }

-- 
Cariad Ilmàra
http://cariad.adnx.net/
"Unix was made to please the programmers,
Mac was made to please the users,
Windows was made to please the accountants."



-- 
Horde mailing list
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: horde-unsubscribe at lists.horde.org



-- 
Cariad Ilmàra
http://cariad.adnx.net/
"Unix was made to please the programmers,
Mac was made to please the users,
Windows was made to please the accountants."




More information about the dev mailing list