Get text color and apply to bar

So I am using the default lvgl theme.

With text when switching to dark mode the text inverts and goes white, however I have a bar object that I want its border to also change from black to white when enabling dark mode. Just wondering how I can set its color dynamically?

Thanks,
Seb