Customizing styling based on theme - vscode integration #1358
-
Hey there, I am trying to change the colour of my edges based on the vscode theme in use by the user. They automatically change from black to grey when the user switches between light and dark themes. However I'm having trouble adding conditions in the client CSS to customize my edges further ( eg make the fill colour of the edge arrow black on dark mode instead of white because it's hard to read against the grey of the edge itself). Wondering if I maybe this doesn't work because I'm giving the style on the client side and I need to add CSS into the webview instead? I tried media queries such as @media (prefers-color-scheme: dark) but with no luck. Cheers |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @jmenzies12, I have never tried using
|
Beta Was this translation helpful? Give feedback.
Hi @jmenzies12,
it shouldn't matter whether you add you custom css on the client side or directly in the webview part. (The webview consumes the client anyways and should have all of its css imported as well). However, if you want to be on the safe side adding it to the webview is the right call.
I have never tried using
@media
for theme specific customizations. In general, there are two common approaches for theme specific css customizationsReuse the builtin
--vscode-xxx
css variables. VSCode uses css variables to provide theme specific colors. So a straight forward and simple solution is to reuse these css-variables in your custom style. The GLSP Vscode integration heavily uses this …