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

Ability to detect whether a theme is light/dark programatically #46940

Closed
DanTup opened this issue Mar 29, 2018 · 8 comments
Closed

Ability to detect whether a theme is light/dark programatically #46940

DanTup opened this issue Mar 29, 2018 · 8 comments
Assignees
Labels
feature-request Request for new features or functionality themes Color theme issues

Comments

@DanTup
Copy link
Contributor

DanTup commented Mar 29, 2018

This has been requested before (#7589) but I don't believe the suggest solution covers all cases (as suggested in the last comment).

I'm trying to insert images into hovers for icons like this:

I have URLs for where the icons live like this:

https://storage.googleapis.com/material-icons/external-assets/v4/icons/svg/ic_favourite_white_24px.svg
https://storage.googleapis.com/material-icons/external-assets/v4/icons/svg/ic_favourite_black_24px.svg

However without knowing whether the theme is Dark or Light, I can't tell which if the colours to insert.

@vscodebot vscodebot bot added the themes Color theme issues label Mar 29, 2018
@bpasero bpasero added the feature-request Request for new features or functionality label Apr 1, 2018
@bpasero bpasero assigned aeschli and unassigned bpasero Apr 1, 2018
@aeschli
Copy link
Contributor

aeschli commented Apr 3, 2018

duplicate of #32813 (not exactly, I agree, but it, in the end, it goes in the same direction).

Did you try 'currentColor' in your svg?
(https://css-tricks.com/cascading-svg-fill-color/)

@aeschli aeschli closed this as completed Apr 3, 2018
@DanTup
Copy link
Contributor Author

DanTup commented Apr 3, 2018

@aeschli That issue is about accessing colours; I don't want to know the colour, only if Code considers it light or dark.

I don't think currentColor helps - these SVGs are remotely hosted and I need to choose between the black or white one (I can't modify them unless I pull them all down locally).

@DanTup
Copy link
Contributor Author

DanTup commented Apr 18, 2018

@aeschli Is it possible this can be reconsidered? I don't think the "duplicate" case is going to help me, I need to know whether to use the black or white version of my image :(

@aeschli
Copy link
Contributor

aeschli commented Apr 18, 2018

Sorry, there are currently no plans for new API in that area.

@DanTup
Copy link
Contributor Author

DanTup commented Apr 18, 2018

@aeschli Are there any workarounds or other ways I could handle do this? It's frustrating that Code has knowledge of the theme but extensions can't make decisions based on it. On a light theme my white images aren't visible, it looks really bad.

@aeschli
Copy link
Contributor

aeschli commented Apr 18, 2018

Sorry, I'm not aware of any other tricks. Using images in hover is possible but not really the intended usage of hovers.

@DanTup
Copy link
Contributor Author

DanTup commented Apr 18, 2018

@aeschli The problem is the same wherever I put it. Users have asked for the icon previews in the gutter (this is where IntelliJ shows them) but it's the same issue - we don't know when to use the dark/light versions.

Would you accept a PR that added this somewhere if I could figure out how to do it?

@aeschli
Copy link
Contributor

aeschli commented Apr 18, 2018

In the gutter you can provide both a light and dark version of your icon

@vscodebot vscodebot bot locked and limited conversation to collaborators May 18, 2018
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 themes Color theme issues
Projects
None yet
Development

No branches or pull requests

3 participants