Is there a general way to get a themes primary colour?

The easiest way to follow the “theme style” is not to add CSS of your own.

There is really no such thing as “theme color scheme” and if there was, it might be hard coded.