How to use themed colors variables?

Hi!

How can I use color variables that change depending on the active theme? I tried to use the theme-color function, but after changing the theme, the color remained the same.