nemo
nemo

Reputation: 153

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.

Upvotes: 7

Views: 1797

Answers (1)

otoomey
otoomey

Reputation: 999

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

Upvotes: 1

Related Questions