#1413 closed enhancement (fixed)
Allow 360/100/100 input for dojo.gfx.color.hsv2rgb
Reported by: | Owned by: | Tom Trenka | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | General | Version: | 0.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
This patch allows other input/output ranges for the HSV values passed in to dojo.gfx.color.hsv.
I work on the Web UI for the Cosmo calendaring project at OSAF (I've submitted some dojo.date patches through Adam Peller), and the colors swatches for various calendars in the UI have to be programmatically generated according to a specific set of hues. Both Photoshop and GIMP use 0-360 for hue, and 0-100 ranges for saturation and value, but dojo.gfx.color.hsv2rgb uses 0-255 for all of them.
This patch allows you to pass in an object with input/output range options so you can do input in 360/100/100, 360/1.0/1.0, etc. You can also have it output the RGV values as a percent or a decimal number. The opts object works like this:
{ 'inputRange': [360, 100, 100] }
{ 'inputRange': [360, 100, 100], 'outputRange': 100 }
{ 'inputRange': [360, 1, 1], 'outputRange': 100 }
You can pass an inputRange, an outputRange, or both. The default with no opts parameter is still 255/255/255 outputting to 255.
I'm happy to write a bunch of tests to confirm the output, and also to write the reverse for rgb2hsv, but I just wanted to see first if the approach of passing in options like this is something y'all are interested in.
Attachments (1)
Change History (3)
Changed 14 years ago by
Attachment: | dojo_gfx_color_hsv-mde-20060907.patch added |
---|
comment:1 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Merged with modifications.
comment:2 Changed 14 years ago by
Resolution: | → fixed |
---|
Patch for dojo.gfx.color.hsv2rgb