Expose theme name in webviews#98128
Conversation
Fixes microsoft#97663 Adds a data attribute to webviews with the theme name. This is lets extensions write theme specific css for webviews
|
There are hundreds of existing themes out there and they can be updated anytime. I don't see how a webview provider could keep track with that. Can you explain the use case? |
|
here is the origin issue, Binaryify/OneDark-Pro#388 |
|
Ok, I see a theme wants to style the markdown preview through |
|
@aeschli no just for background color, include the code highlight and the elements style |
|
@aeschli Extensions should use the normal theme color variables in almost all cases. We also already expose the theme kind (light, dark, high contrast) The theme name is helpful if you want to write CSS that is only enabled in one specific theme. For example, the official GitHub theme may contribute CSS rules to the markdown preview that are only enabled when the GitHub theme is active |
vscode-theme-kind is generic kind: light, dark, high contrast. We already expose this as a classname but for conistency also want to have it as an attribute





Fixes #97663
Adds a data attribute
data-vsccode-themeto webviews with the current theme name. This is lets extensions write theme specific css for webviews, for example: