mrlacey / CSInlineColorViz

See samples of the colors you use within your C# code.
https://marketplace.visualstudio.com/items?itemName=MattLaceyLtd.CSInlineColorViz
MIT License
21 stars 2 forks source link

Support hex literals #5

Closed saaldigital-bc closed 2 years ago

saaldigital-bc commented 2 years ago

Example: var color = 0xff0000;

I think it would be best to check if its exactly in this format since it could be mixed up with other hex literals that aren't colors like: 0x32ff

mrlacey commented 2 years ago

But 0x32ff is (or could be) a valid color. It's pale blue.

image

I'm reluctant to add this because I've never seen colors specified as integers via a hex literal before. There may be project types or scenarios where this is commonplace, but I'm not aware of them. My concern is that making such a change would result in more things being annotated as if they were colors but actually they're not.

saaldigital-bc commented 2 years ago

In the projects I'm working on I got it all the time, but I don't know how it's done in the majority of projects. I understand your concerns. Maybe adding a setting to toggle it would be a thought.

mrlacey commented 2 years ago

Adding this. Can make it configurable in the future if requested/needed.

image

Just published this functionality to the store as version 1.8.

If this is helpful, ratings and sponsorship help :)