Robert Važan

ColoredImage in JungleControls

Easily generate colored variations from grayscale mask using ColoredImage XAML control from JungleControls WPF library.

Designers like shades of gray as well as various highlight colors. But you have only one monochromatic icon, so what do you do? There's this nice OpacityMask trick in WPF that will do the job, but it's a lot of code. I wrapped it up for you in ColoredImage WPF control that is part of my opensource JungleControls library.

Below is a demo of changing color of an icon. Only alpha channel of the image is preserved. Remaining channels (R,G, and B specifically) are set to the fill color. Notice that even the alpha channel can be toned down if necessary.

Demo with adjustable RGBA parameters
RGB channels are replaced with solid color while alpha channel is preserved or scaled.

You can use the control from XAML like this:

<jc:ColoredImage Foreground="Yellow" Source="TestImage.png" />

Pretty straightforward.

ColoredImage supports the following properties:


You can download this control as part of my opensource JungleControls library. Enjoy.