Theming - auto text colour adjustement

Excuse my trivial question but I cannot find the place where it happens.

I’m currently trying to custom theme my app and when I change the background colour of the toolbar to sth dark,
the text automatically turns to white (to retain contrast). Where does this auto conversion happen in the source?

Would it be the result of some Sass fn?