Skip to content

Commit 4320218

Browse files
committed
Themeroller: Fix alpha treatment in icons
Since jQuery UI 1.13.0, partially transparent pixels in the icons file started being too dark. Set gamma to 0.5 for the A channel to get closer to the 1.12.1 output. A test comparing similarity of the generated image to the jQuery 1.12.1 has been added as well. Fixes jquery/jquery-ui#2339
1 parent 109b6d8 commit 4320218

6 files changed

+363
-22
lines changed

lib/themeroller-image.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ generateIcon = function( params, callback ) {
130130

131131
// https://usage.imagemagick.org/masking/#shapes
132132
// See https://github.com/jquery/download.jqueryui.com/issues/132 for why
133-
// `-set colorspace RGB` is needed (twice) in IM >6.7.9. Full command:
134-
// $ magick <icons_mask_filename> -set colorspace RGB -background <color> -alpha shape -set colorspace sRGB output.png
133+
// * `-set colorspace RGB` is needed (twice) in IM >6.7.9.
134+
// * `-channel A -gamma 0.5` is needed so that partially transparent
135+
// pixels are not too dark.
136+
// Full command:
137+
// $ magick <icons_mask_filename> -set colorspace RGB -background <color> -alpha shape -channel A -gamma 0.5 -set colorspace sRGB output.png
135138

136139
imageQueue.push( function( innerCallback ) {
137140
try {
@@ -140,6 +143,7 @@ generateIcon = function( params, callback ) {
140143
"-set", "colorspace", "RGB",
141144
"-background", color,
142145
"-alpha", "shape",
146+
"-channel", "A", "-gamma", "0.45",
143147
"-set", "colorspace", "sRGB",
144148
"png:-"
145149
], innerCallback );

0 commit comments

Comments
 (0)