CSInlineColorViz icon indicating copy to clipboard operation
CSInlineColorViz copied to clipboard

hex constants are too aggressively assumed to represent colors

Open TymurGubayev opened this issue 7 months ago • 2 comments

private const int TV_FIRST = 0x1100;

is shown with a color preview Image

IMO it shouldn't.

TymurGubayev avatar May 20 '25 10:05 TymurGubayev

I've seen this a few times in code files and agree that yes, it would be nice if it didn't pick these up, but it's only (for me) something I see occasionally, and so I haven't cared enough to do anything about it.

So, what to do:

  • Live with it?
  • Apply some clever heuristic to try and determine if it's supposed to be a colour?
  • Have a configurable setting where you can opt out of this behaviour?
  • Have a configurable setting where you can opt in to see colour indicators on anything that might be a hex representation of a colour?

mrlacey avatar May 20 '25 15:05 mrlacey

I don't know in what context a 4-digit hex is a color (unless it's interpreted as 0x001100), so IMHO limit it to 6 or 8 digits, and offer an opt-in for more. And maybe also have an opt-out for all the ints.

TymurGubayev avatar May 20 '25 16:05 TymurGubayev