Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Extensions: ability to detect light/dark theme #7589

Closed
warpdesign opened this issue Jun 12, 2016 · 7 comments
Closed

[Feature Request] Extensions: ability to detect light/dark theme #7589

warpdesign opened this issue Jun 12, 2016 · 7 comments
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@warpdesign
Copy link
Contributor

It seems there's no way to detect the if the current theme is dark or light.

This can be a problem if the extension has complex css, like this one http://stackoverflow.com/questions/37257911/detect-light-dark-theme-programatically-in-visual-studio-code

It would be great if there was a way to determine the kind of theme applied from the extension

@warpdesign warpdesign changed the title Extensions: ability to detect light/dark theme [Feature Request] Extensions: ability to detect light/dark theme Jun 12, 2016
@rebornix
Copy link
Member

@warpdesign we are extracting VS Code's markdown support to a separate extension and we've implemented the theme detection both in the extension and vscode side. Please keep an eye on #6106, once June release is out, you'll get what you want.

@jrieken
Copy link
Member

jrieken commented Jun 13, 2016

@warpdesign The view your html is rendered in uses some css variables which hold values for the background and foreground colors. Would those be sufficient?

@jrieken
Copy link
Member

jrieken commented Jun 15, 2016

With PR #7656 we will introduce these class names: vscode-light, vscode-dark, and vscode-high-contrast. Depending on the theme one of them is set on the document body.

@jrieken jrieken added this to the June 2016 milestone Jun 15, 2016
@jrieken jrieken added the feature-request Request for new features or functionality label Jun 15, 2016
@warpdesign
Copy link
Contributor Author

@jrieken that's perfect!
👍

@jrieken
Copy link
Member

jrieken commented Jun 25, 2016

We have this since merging the MD extension to master: vscode-light, vscode-dark, or vscode-high-contrast (https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/html/browser/webview.ts#L46)

@jrieken jrieken closed this as completed Jun 25, 2016
@jrieken
Copy link
Member

jrieken commented Jun 27, 2016

  • Test Plan Item created
  • Key board accessible
  • Screen reader accessible
  • Works with the different themes, including the high contrast theme
  • Telemetry events in place
  • Release notes updated

@jaime-olivares
Copy link

Relying on CSS class names won't help in all use-cases. Sometimes you need to know the theme "darkness" before generating the output html (bitmap, svg, etc.).

From an extension, we are able to know almost every editor setting. Why the theme is an exception?

Isn't it better to have an enumeration with light/dark/contrast values? or even access to every theme color for a precise matching?

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants