#13370 closed defect (fixed)
dijit.ColorPalette needs better support for transparent
Reported by: | rmaccracken | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Dijit | Version: | 1.6.1 |
Keywords: | ColorPalette transparent | Cc: | [email protected]…, nic, Eugene Lazutkin |
Blocked By: | Blocking: |
Description
I have written an SVG editor and need "transparent" as one of my colors in the palette and would like its value to be "none" rather than a hex value of #ffffff or #000000.
There are a few problems in trying to implement this:
1) Even though the dijit._PaletteMixin provides a "dyeClass" member to override the dyeClass, dijit.ColorPalette provides its own so that there is not a simple way to override it.
2) dojo.Color.named.transparent is set to [255,255,255] (or dojo.config.transparentColor) in dojo/_base/Color.js, but is then overridden by dojo/colors.js and changed to [0,0,0,0]. I'm not sure why this happens, but seems a bit strange. In any case, the toHex function does not distinguish transparent from black/white. I think it makes sense to return "none" as a special case for transparent.
3) transparent is not available in the localization for colors
Change History (5)
comment:1 Changed 10 years ago by
Cc: | nic Eugene Lazutkin added |
---|
comment:2 Changed 10 years ago by
comment:3 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 Changed 10 years ago by
Milestone: | tbd → 1.7 |
---|
The "transparent" color is originally from [9659] (which should have added it to the NLS files) but the discrepancy appears in [18795]. Looks like the entry in dojo/colors.js should be removed now that "transparent" has been added to dojo/_base/Color.js. I don't know which setting is better, the first three numbers seem meaningless and neither file has an opacity setting for transparent.
As for dijit I can add a getDyeClass() method to dijit.ColorPalette (that returns the subclassed dijit._Color constructor), or perhaps better a getDye() method to _PaletteMixin that returns an instance. (I'm thinking that the "dyeClass" member was a mistake given that it doesn't allow enough customization for dojo.ColorPalette to work, let alone your extension.) Any opinions there?