wxBitmap used as an icon, any way to change the colours? This is to convert the colours for dark mode.

39 views
Skip to first unread message

Tony Kennedy

unread,
Sep 6, 2021, 2:48:43 AM9/6/21
to wx-users
Hello all,

My app works well in dark mode by taking a colour, converting to HSL, modifying the luminescence and converting back to RGB. I'd like to do the same with the icons if I can.

I've tried using the wxBitmap::GetPalette, but I always get a NULL returned. I've experimented with other things, but failed all the time.

Does anyone know a way of doing this? Most of my icons have less than 5 colours, I was hoping I could get a list of them, modify them and apply them to the original bitmap.

Thanks in advance,

Tony.

Vadim Zeitlin

unread,
Sep 6, 2021, 6:00:29 AM9/6/21
to wx-u...@googlegroups.com
On Sun, 5 Sep 2021 23:48:43 -0700 (PDT) Tony Kennedy wrote:

TK> Hello all,
TK>
TK> My app works well in dark mode by taking a colour, converting to HSL,
TK> modifying the luminescence and converting back to RGB. I'd like to do the
TK> same with the icons if I can.
TK>
TK> I've tried using the wxBitmap::GetPalette, but I always get a NULL
TK> returned. I've experimented with other things, but failed all the time.

Palettes are not really used since a couple of decades already, so this is
not going to work.

TK> Does anyone know a way of doing this? Most of my icons have less than 5
TK> colours, I was hoping I could get a list of them, modify them and apply
TK> them to the original bitmap.

Icons are typically not that big, so you could just convert wxBitmap to
wxImage, transform each pixel individually and then convert it back.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Tony Kennedy

unread,
Sep 8, 2021, 3:25:40 AM9/8/21
to wx-users
Thanks for the suggestion. It works well, sadly the icons still do not look great in dark mode so it looks like they will need to be updated manually.

Tony.

Reply all
Reply to author
Forward
0 new messages