Skip to content

Commit 1d8d9b5

Browse files
committed
Fix mozilla#150 - Fix colour editor for use in browsers that don't use -webkit- prefix
1 parent 8b906d3 commit 1d8d9b5

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/extensions/default/InlineColorEditor/ColorEditor.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,13 @@ define(function (require, exports, module) {
171171

172172
// Update gradients in color square & opacity slider
173173
this.$selectionBase.css("background-color", colorObject.toHexString());
174-
this.$opacityGradient.css("background-image", "-webkit-gradient(linear, 0% 0%, 0% 100%, from(" + hueColor + "), to(transparent))");
175-
174+
this.$opacityGradient.css("background-image", "-moz-linear-gradient(top, " + hueColor + " 0%, rgba(0,0,0,0) 100%)");
175+
this.$opacityGradient.css("background-image", "-webkit-gradient(linear, top, bottom, color-stop(0%, " + hueColor + "), color-stop(100%,rgba(0,0,0,0)))");
176+
this.$opacityGradient.css("background-image", "-webkit-linear-gradient(top, " + hueColor + " 0%, rgba(0,0,0,0) 100%)");
177+
this.$opacityGradient.css("background-image", "-o-linear-gradient(top, " + hueColor + " 0%, rgba(0,0,0,0) 100%)");
178+
this.$opacityGradient.css("background-image", "-ms-linear-gradient(top, " + hueColor + " 0%, rgba(0,0,0,0) 100%)");
179+
this.$opacityGradient.css("background-image", "linear-gradient(to bottom, " + hueColor + " 0%, rgba(0,0,0,0) 100%)");
180+
176181
// Update slider thumb positions
177182
this.$hueSelector.css("bottom", (this._hsv.h / 360 * 100) + "%");
178183
this.$opacitySelector.css("bottom", (this._hsv.a * 100) + "%");

src/extensions/default/InlineColorEditor/css/main.less

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,17 @@
138138
}
139139
.color-editor section .color-selection-field .saturation-gradient {
140140
background-image: -webkit-gradient(linear, 0% 50%, 100% 50%, from(#fff), to(rgba(255,255,255,0)));
141+
background-image: -moz-linear-gradient(left, #FFFFFF 0%, rgba(255,255,255,0) 100%);
142+
background-image: -o-linear-gradient(left, #FFFFFF 0%, rgba(255,255,255,0) 100%);
143+
background-image: -ms-linear-gradient(left, #FFFFFF 0%, rgba(255,255,255,0) 100%);
144+
background-image: linear-gradient(left, #FFFFFF 0%, rgba(255,255,255,0) 100%);
141145
}
142146
.color-editor section .color-selection-field .luminosity-gradient {
143147
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#000));
148+
background-image: -moz-linear-gradient(bottom, #000000 0%, rgba(255,255,255,0) 100%);
149+
background-image: -o-linear-gradient(bottom, #000000 0%, rgba(255,255,255,0) 100%);
150+
background-image: -ms-linear-gradient(bottom, #000000 0%, rgba(255,255,255,0) 100%);
151+
background-image: linear-gradient(bottom, #000000 0%, rgba(255,255,255,0) 100%);
144152
}
145153
.color-editor section .color-selection-field .selector-base {
146154
width: 12px;
@@ -203,6 +211,10 @@
203211
}
204212
.color-editor section .hue-slider {
205213
background-image: -webkit-linear-gradient(top, #f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00);
214+
background-image: -moz-linear-gradient(top, #f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00);
215+
background-image: -o-linear-gradient(top, #f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00);
216+
background-image: -ms-linear-gradient(top, #f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00);
217+
background-image: linear-gradient(top, #f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00);
206218
}
207219
.color-editor section footer {
208220
font-size: 100%;

0 commit comments

Comments
 (0)