zed icon indicating copy to clipboard operation
zed copied to clipboard

Show inline previews for rgb hex color strings (LSP `textDocument/documentColor`)

Open probablykasper opened this issue 2 years ago • 29 comments

Describe the feature

Show a color preview for languages like CSS and Tailwind.

VSCode has this, which it calls "color decorators":

image

JetBrains editors, such as PyCharm, take it one step further and provide a color wheel + picker that can be opened by clicking on the color preview. This allows you to change the color in a more human friendly way, while having the changes reflected in the source code in the original format.

I use a color highlight extension which enables different styles: imageimageimage imageimage

LSP can provide this via textDocument/documentColor.

probablykasper avatar Jun 18 '23 23:06 probablykasper

This would be amazing. Is it in the roadmap?

rafatrace avatar Feb 07 '24 12:02 rafatrace

That'd be amazing to have. I really use this feature when working with Tailwind

gbrrrl-no avatar Feb 16 '24 17:02 gbrrrl-no

Really important feature for me

SergoGansta777 avatar Mar 26 '24 17:03 SergoGansta777

This is a very important feature for FE devs as we tend to work with colors. Would appreciate if this is added 👌

OgDev-01 avatar May 06 '24 15:05 OgDev-01

Was just looking for this myself! +1 on this!

christ-offer avatar May 15 '24 12:05 christ-offer

Going to unify any "color preview" issues and point them at this issue.

There is precedent with inlay hints, but I think this is non-trivial to add due to needing to dive into the editor paint/render code.

Happy to support the final design of what previews look like if someone builds the feature and opens a PR.

iamnbutler avatar May 27 '24 18:05 iamnbutler

Looking forward to this one. It's one of the very useful features I had in VSCode that I'm missing on Zed.

kaumac avatar Jun 10 '24 19:06 kaumac

Screenshot 2024-05-26 alle 14 56 33 Screenshot 2024-05-26 alle 14 53 43

It would be useful if next to the line indicating the color you could see a preview of it, and if necessary also be able to modify it using a picker that is activated when you click on the color.

Angelk90 avatar Jun 12 '24 14:06 Angelk90

would also be very nice for it to be a per-language togglable feature.

7unn3l avatar Jul 31 '24 20:07 7unn3l

Any update on this feature? Would be very nice to have this feature during FE development.

PlanB007 avatar Aug 02 '24 08:08 PlanB007

Would be a very nice feature!

NGSpace avatar Aug 15 '24 20:08 NGSpace

need this feature in zed asap

JesusButForGayPeople avatar Aug 16 '24 12:08 JesusButForGayPeople

There are quite a few people watching this topic. Please don't sent out emails/notifications to everyone just to say "me too!" when a simple thumbs-up on the top post would be sufficient.

claire-west avatar Aug 20 '24 13:08 claire-west

Suggestion: I think these colors should show up in CSS and CSS-like languages, but not only that, things like hex colors or 0x notations of colors should show up in basically any language as well. You might want to have it be a setting as well! Someone mentioned something similar here already.

Also, a thin underline might work better with the style of zed, but that means it's harder to figure out what that color actually is at times.

TheRedXD avatar Aug 21 '24 11:08 TheRedXD

I would absolutely love this feature!

Kucito avatar Aug 23 '24 16:08 Kucito

I would absolutely love this feature!

Please just like the issue, instead of commenting on it. Comment ONLY if you have something to add to it. A few people not following basic common sense like this makes it worse for literally everyone else who wants to add to it.

TheRedXD avatar Aug 24 '24 16:08 TheRedXD