Is there a way to programatically determine the plasma accent color?

Context

I prefer to follow user’s preferences when developing GUIs. One visually impactful part of that is their chosen system accent/highlight color.

On Windows I can read the AccentColorMenu registry entry.
On Mac I can read the AppleAccentColor property.
But I haven’t figured out how to determine it in KDE Plasma yet.

I didn’t find anything in env, by grepping through the filesystem or searching the internet.

Question

Is there a file I could read or interface I could ask for the configured Accent Color from Settings > Appearance and Style > Colors & Themes > Global Theme > Colors?

Notes

  • KDE Plasma version of interest: 6+
  • Graphics platform of interest (if it makes a difference): Wayland

Thanks in advance for any hints!

You will probably want to access it via the Settings Portal which is easily accessible over D-Bus:

(Read called with org.freedesktop.appearance accent-color)

2 Likes

Thank you! That should be everything I need. :hushed:

I was also able to access the same information via dbus-send and already found some dbus APIs/bindings I could directly use in different programming/scripting languages.