Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Get windows color

I'll be brief: How do I get the color that the user can specify on the windows platform? On windows 10 it's the color of the tiles when you open the start menu. SystemColor doesn't work, it just returns the color 153 180 209 (a light blue) for SystemColor.activeCaption no matter what the setting is set to on every version of windows. UIManager is practically useless. The names of the keys seem to be different on every version of windows. It seems that SystemColor works on Mac and Linux. Any ideas as to how I get this color? Thanks.

like image 547
nemo Avatar asked Sep 19 '15 16:09

nemo


1 Answers

Found out how to do this recently. There is a value in the windows registry called HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\AccentColor, that stores the system window title color. You can use JNA's Advapi32Util to read the value from the Windows registry.

You can then use a graphics library like java.awt.Color to convert the color into RGB values.

There is an implementation of this here

like image 89
otoomey Avatar answered Oct 02 '22 14:10

otoomey