-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Shortcut for opening color picker and insert color of selected format #52364
Comments
(Experimental duplicate detection)
|
I'd love to see this feature aswell, +1. |
I'm closing this as Sass do not have a language server, which is needed to support this feature. A simplified explanation as to how color picker works:
CSS/Less/Scss have language servers that can respond with color information properly. Sass doesn't have a LS to begin with. |
@octref That was not the main thing this is about. I want to spawn a color picker anywhere (using a shortcut), regardless of whether there's already a color code in the document or not. |
@SpectralKH If you mean you want to spawn a color picker that doesn't have anything to do with the color code in a document, you can implement it as a Webview extension or look for existing extensions: https://marketplace.visualstudio.com/search?term=color%20picker&target=VSCode&category=All%20categories&sortBy=Relevance |
@octref None of the existing ones work for me (on macOS). This should be built-in and consistent between platforms. |
@octref I want that color picker brought up by a shortcut anywhere. |
You bring it up with a shortcut and pick a color, what do you expect to happen then? |
@octref I expect the popup from the image you shared to show up. Then I'd pick a color and press enter or something for the color code to be pasted in. To change the type of color code type (HEX, RGB, etc) to paste in, you could |
For that I suggest you use an alternative tool, like Sip app https://sipapp.io. But anyway, I'll keep it open and I've updated the title. |
I'm looking for the same functionality - just spawn a color-picker with a command and insert the hex/rgb value at the caret no matter what file type is open. The vs marketpalce has two extensions with colorpickers. One doesn't work at all, the other uses ugly legacy windows color picker which is not very user-friendly. Considering this color picker is already there... |
In the same boat, trying to get the color picker to activate while in a JSX file. |
I am trying to specify colors within strings inside a javascript object. Would LOVE to have color picker available to change on the fly instead of going to browser, finding hex codes from designer app, copying, going back to vscode, carefully selecting the right hex code, pasting in, making sure not have duplicate # characters, making sure the string isn't ruined by whitespace or missing " character, etc. |
Same problem using JSX... Isn't there any command to force launch the picker on whatever file extension and then just paste the result in the text? |
Still waiting in 2021 for the feature to show color picker at will... |
Why can't vscode have a setting to enable color picker outside of html and css files? |
Based on @octref explanation about the language server limitation for certain languages, and given my need to have color picker on a |
With the json-color-token 1.2.0 extension, you can specify which language types to invoke a HEX color picker. You can see I enabled the color picker is enabled for json, jsonc, python, and toml files. (See YECHUNAN/json-color-token#2 for explanation). |
Let me save your lives: Name: vscode-color-picker |
That is useful, thanks. Even if it's some way short of the kind of truly language-agnostic approach I envisaged in #52364 (comment). |
Found not way to spawn color picker in PHP files, someone managed to do this ? |
Yes. See #52364 (comment). |
Never mind just saw I has to add the php language into the extension parameter to supported languages.
|
If #178242 is limited to CSS-formatted colours, that's kind of disappointing. Just because most popular languages have so much ceremony around using custom datatypes that everyone prefers to use strings for everything, doesn't mean the rest of us should suffer! At the very least, is there a reason why the last line of the screenshot doesn't seem to trigger the color picker? If |
Hi, @georgefst, thanks for your comment. The standalone color picker works for other language formats provided you have an extension installed that defines a DocumentColorProvider. The demo in the video, shows the default behavior when no marketplace extensions are installed, so that the user can still use the color picker when no DocumentColorProviders are present. The default is the CSS format. You may search in the marketplace for extensions that provide color functionality for the language of your choice. The last line does not trigger a color, because there is no color present there. The PR essentially added a default DocumentColorProvider, which detects if there is a CSS color at the cursor position, and initializes the color picker with that color. If no color is detected, the default RGB(0,0,0,1) is chosen. The value rgb(r, g, b) does not have to be in quotes when using the default provider. The only reason it is in quotes inside of the video is so that the compiler does not throw errors. As well as that the provider works even if there is a space between the values r, g and b, so there is no need to format. |
Ok cool, that's much more promising than I expected, thanks! I might have to try writing a colour provider extension for more idiomatic Haskell syntax, but it sounds like the "default" CSS one will be usable. |
Problem
A huge dealbreaker for me is that VSCode just doesn't let me use the color picker ever, because I'm using Sass files. There does not seem to be any color picker extension that provides the functionality either, that isn't Windows-specific (I'm running macOS).
Feature request
I'd like the ability to spawn a color picker anywhere. So there would be a command that does exactly that, and when you're done it inserts the color code.
A nice inclusion would be if it could know if the cursor is in a color code, and accordingly update that color code. VSCode seems to do this only in a few file types now, which is a bummer for anyone not using those. I don't demand this, as long as I can get a color picker I'm content.
The text was updated successfully, but these errors were encountered: