In my React plugin I have a style sheet where I am trying to make sure my border color is theme aware. Using the “–uxp-host-text-color” that is supposed to be available doesn’t seem to be found.
The debugger only shows the --border-color for :root and that var(--border-color) evaluates to black yet the borders around the radio button group are white.
It still doesn’t work for me trying to use the –uxp-host-text-color CSS variable that is supposed to be there, but this makes my plugin theme aware.
Tried with Photoshop 25.6.0 and macOS 12.7.3. --uxp-host-text-color is reflected in the appearance and follows theme changes.
However, the white color is slightly different from sp-boby and other text colors in the darkest and dark themes, so even if it works fine, there may be some discomfort.
It is better to operate the variables yourself as you did, or place them under the control of the Spectrum Web Components theme.
The Spectrum Web Components should be able to be used according to this document. This is the most difficult part.
Then make the top level of the panel sp-theme. Doing so will put sp-button, etc. under the influence of sp-theme.
You can also use CSS variables such as --spectrum-gray-800 to use colors that change according to the theme. I am using Preact, so the way to write it is slightly different.
{/* place sp-theme at top level */}
<sp-theme
theme='spectrum'
color={colorTheme}
scale='medium'
>
{/* your components here */}
<sp-button>Test</sp-button>
<hr style='background-color: var(--spectrum-gray-800) ;' />
</sp-theme>