Permalink
Browse files

Further enhancements to issue 3871 (Change color format)

  • Loading branch information...
1 parent 17ff6a8 commit 31a8302dfd8c7389d25dc91aa623f0c4294f02d1 @SebastianZ SebastianZ committed May 29, 2012
Showing with 12 additions and 12 deletions.
  1. +9 −11 extension/content/firebug/css/cssModule.js
  2. +3 −1 extension/content/firebug/lib/css.js
@@ -369,14 +369,6 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
return propInfo;
},
- setColorDisplay: function(event, type)
- {
- Options.set("colorDisplay", type);
-
- var menuItem = event.target;
- menuItem.setAttribute("checked", "true");
- },
-
getColorDisplayOptionMenuItems: function()
{
return [
@@ -387,7 +379,9 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
type: "radio",
name: "colorDisplay",
id: "colorDisplayHex",
- command: Obj.bind(this.setColorDisplay, this, "hex"),
+ command: function() {
+ return Options.set("colorDisplay", "hex");
+ },
checked: Options.get("colorDisplay") == "hex"
},
{
@@ -396,7 +390,9 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
type: "radio",
name: "colorDisplay",
id: "colorDisplayRGB",
- command: Obj.bind(this.setColorDisplay, this, "rgb"),
+ command: function() {
+ return Options.set("colorDisplay", "rgb");
+ },
checked: Options.get("colorDisplay") == "rgb"
},
{
@@ -405,7 +401,9 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
type: "radio",
name: "colorDisplay",
id: "colorDisplayHSL",
- command: Obj.bind(this.setColorDisplay, this, "hsl"),
+ command: function() {
+ return Options.set("colorDisplay", "hsl");
+ },
checked: Options.get("colorDisplay") == "hsl"
}
];
@@ -709,6 +709,8 @@ Css.rgbToHSL = function(value)
{
return value.replace(/\brgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*(\d.\d+|\d))?\)/gi,
function(_, r, g, b, _, a) {
+ var gray = (r == g && g == b);
+
r /= 255;
g /= 255;
b /= 255;
@@ -720,7 +722,7 @@ Css.rgbToHSL = function(value)
var s = 0;
var l = (max+min)/2;
- if (max != min)
+ if (!gray)
{
var delta = max - min;
s = l > 0.5 ? delta/(2-max-min) : delta/(max+min);

0 comments on commit 31a8302

Please sign in to comment.