User:Harthur/ColorConversion

From MozillaWiki
< User:Harthur
Revision as of 23:50, 13 September 2009 by Harthur (talk | contribs) (Created page with '= About = download: [http://colorplay.googlecode.com/files/colorCommon.js colorCommon.js] This is a javascript library for converting colors between different color formats. It …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

About

download: colorCommon.js

This is a javascript library for converting colors between different color formats. It supports rgb, hsl, and hsv. To call a method of the library simply say colorCommon.methodName(). Valid color strings can take one of the following formats: #00FF00, rgb(0, 255, 0), rgb(0%, 100%, 0%), hsl(120, 100%, 50%), hsv(120, 100%, 100%)

API

toHex

gets a Hex string for a color

parameter:

  • any valid color string

return:

  • a string of the color in hex format

example:

bugzillaRPC.getBug(48875,
                        function(bug) {alert(bug.summary);},
                        function(errMsg) {alert(errMsg)});

getBugs

Retrieves an array of bug objects

parameters:

  • ids - an array of bug ids
  • callback
  • errback

success parameter:

  • bugs - An array of objects defined by Bugzilla XML-RPC's getBugs return value. with properties id, summary, creation_time, last_change_time, and the internals object which has various other properties.

example:

bugzillaRPC.getBugs([8117, 2344],
                        function(bugs) {alert(bugs[0].summary);},
                        function(errMsg) {alert(errMsg)});