How to apply custom css in Kibana UI

There's not, hacks don't have an API, they just inject some script into the page. If you wanted to execute code conditionally as you navigate the app, you'd have to implement that yourself. You could, as one solution, watch for changes in the URL and react accordingly.

Another way to do this is to write a plugin that simply imports your styles, and use specific CSS selectors to override colors. I believe, though have not tested this, that plugin assets get injects after the core Kibana assets, which means your CSS rules should be able to override the rules that ship with Kibana.