How does color scheme configurations work under the hood?

Not sure if it would be better suited for Dev category but here you go.
I’m trying to understand how plasma-apply-colorscheme and the Colors section in System Setting GUI work under the hood.

  • Do files in ~/.kde/share/apps/color-schemes/ have any significance compared to /.local/share/color-schemes/ or /usr/share/color-schemes/?
  • How does plasma-apply-colorscheme --list-schemes determine which color scheme is currently active?
  • What would be the best way to get notified of color scheme changes in my code?

The current colorscheme is saved in the kdeglobals rc file. I have no ~.kde folder, all config is in ~/.config here.

Which distro and version do you have?

I’m on Kubuntu 22.04 if that matters.