Monochrome does not support transparency (Patch included)

0 votes
asked Apr 18, 2013 in Bug by anonymous

With this config:
skinparam backgroundcolor transparent

And this UML:
alt successful
    Server -> Client: OK
else failure
    Server -> Client : ERROR
end

Then generation fails with a NullPointerException.

This patch (bold linies) fixes the bug:

public class ColorMapperMonochrome implements ColorMapper {

    public Color getMappedColor(HtmlColor htmlColor) {
        if (htmlColor == null) {
            return null;
        }
        if (htmlColor instanceof HtmlColorTransparent) {
                return new Color(0,0,0,0);
        }

        final Color color = new ColorMapperIdentity().getMappedColor(htmlColor);
        final int grayScale = (int) (color.getRed() * .3 + color.getGreen() * .59 + color.getBlue() * .11);
        return new Color(grayScale, grayScale, grayScale);
    }
}

Feel free to use code.

Kind regards,
Søren

1 Answer

0 votes
answered May 17, 2013 by plantuml (298,440 points)
Hi,

Thanks for the report and for the patch.

We have fixed this in the current release (V7965)

Regards,
...