Skip to content

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

Closed

Description

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

Activity

  1. changed the title [-]Extensions: ability to detect light/dark theme[/-] [+][Feature Request] Extensions: ability to detect light/dark theme[/+] on Jun 12, 2016
  2. rebornix commented on Jun 13, 2016

    @rebornix
    Contributor

    Nicolas Ramz (@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.

  3. jrieken commented on Jun 13, 2016

    @jrieken
    Contributor

    Nicolas Ramz (@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?

  4. jrieken commented on Jun 15, 2016

    @jrieken
    Contributor

    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.

  5. added
    feature-request
    on Jun 15, 2016
  6. warpdesign commented on Jun 15, 2016

    @warpdesign
    ContributorAuthor

    Johannes Rieken (@jrieken) that's perfect!
    👍

  7. jrieken commented on Jun 25, 2016

    @jrieken
    Contributor
  8. jrieken commented on Jun 27, 2016

    @jrieken
    Contributor
    • 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
  9. jaime-olivares commented on Aug 1, 2016

    @jaime-olivares

    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?

  10. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions