Skip to content

Themeroller: Fix alpha treatment in icons #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/themeroller-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ generateIcon = function( params, callback ) {

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

imageQueue.push( function( innerCallback ) {
try {
Expand All @@ -140,6 +143,7 @@ generateIcon = function( params, callback ) {
"-set", "colorspace", "RGB",
"-background", color,
"-alpha", "shape",
"-channel", "A", "-gamma", "0.45",
"-set", "colorspace", "sRGB",
"png:-"
], innerCallback );
Expand Down
Loading