chrisbra / Colorizer

color hex codes and color names
547 stars 30 forks source link

highlighting hex colour: delimiter #13

Closed teschmitz closed 11 years ago

teschmitz commented 11 years ago

I am using your plugin in a config file and I note that dash and underscore are not recognized as delimiters for hex colours (#rrggbb or #rgb)

Therefore, the following occurrences are not highlighted:

A0A0A0-

A0A0A0_

chrisbra commented 11 years ago

Hm, I suspect, Hex Codes shouldn't be word-bounded at all?

teschmitz commented 11 years ago

Already in use - 15 minutes after commit. Best vim extension ever!

teschmitz commented 11 years ago

The behaviour for the following scenarios has changed. The following hex colours get highlighted now:

FFFFFF00 (the 6 Fs are highlighted)

FFF00 (the 3 Fs are highlighted)

It seems that you recognize # followed by 6 or 3 digits as a colour regadless of the right boundary character. See also issue #7.

I think a 3- or 6-digit hex number should only get highlighted if preceded by a hash and followed by a non-hex digit.

teschmitz commented 11 years ago

However, one pleasing side-effect of the current behaviour is that the RGB in RGBA hex codes get highlighted. I know you can't represent a transparent colour but I still find it useful to see the fully opaque colour.

It would be nice of 8-digit hex codes (#rrggbbaa) could get highlighted with the colour indicated by the first six digits. However, then you would have to support 4-digit RGBA colours, too.

chrisbra commented 11 years ago

Hi teschmitz!

On Do, 06 Dez 2012, teschmitz wrote:

However, one pleasing side-effect of the current behaviour is that the RGB in RGBA hex codes get highlighted. I know you can't represent a transparent colour but I still find it useful to see the fully opaque colour.

I see the problem. It only happens, if you have the same color with 6 hex colors, e.g. #aabbcc than the matcher will also match

aabbccdd

I can fix this easily, I think.

It would be nice of 8-digit hex codes (#rrggbbaa) could get highlighted with the colour indicated by the first six digits. However, then you would have to support 4-digit RGBA colours, too.

RGBA does not seem to be valid currently (at least in CSS).

How common is #RGBA? Would that look like a useful addition?

regards,

Christian

teschmitz commented 11 years ago

On Thu, 06 Dec 2012 12:04:26 -0800 chrisbra notifications@github.com wrote:

RGBA does not seem to be valid currently (at least in CSS).

How common is #RGBA? Would that look like a useful addition?

On second thought, I think it's best to ignore RGBA, particularly if it is not valid CSS.

teschmitz commented 11 years ago

small correction in help file, section "Colorizer History":

0.8: (unreleased) {{{1 - https://github.com/chrisbra/color_highlight/issues/13 (colorizing should not stop at word-boundaries, reported by teschmitz, thanks!)

==>

colorizing should stop at word-boundaries

chrisbra commented 11 years ago

Hi teschmitz!

On Fr, 07 Dez 2012, teschmitz wrote:

small correction in help file, section "Colorizer History":

0.8: (unreleased) {{{1 - https://github.com/chrisbra/color_highlight/issues/13 (colorizing should not stop at word-boundaries, reported by teschmitz, thanks!)

==>

colorizing should stop at word-boundaries

Yeah, but the wording is correct though. You wanted the highlighting not to stop on word-boundaries (_ does not count as word boundary).

regards,

Christian

Arbeit ist der Fluch der trinkenden Klassen. -- Oscar Wilde

chrisbra commented 11 years ago

Hi teschmitz!

On Do, 06 Dez 2012, teschmitz wrote:

On Thu, 06 Dec 2012 12:04:26 -0800 chrisbra notifications@github.com wrote:

RGBA does not seem to be valid currently (at least in CSS).

How common is #RGBA? Would that look like a useful addition?

On second thought, I think it's best to ignore RGBA, particularly if it is not valid CSS.

So we keep it as is.

regards,

Christian

Glaube ist Liebe zum Unsichtbaren, Vertrauen aufs Unmögliche, Unwahrscheinliche. -- Goethe, Maximen und Reflektionen, Nr. 624

omeid commented 8 years ago

RRGGBBAA is now supported in Chrome, Firefox, Android, and React Native. Would be great to have support for it!

chrisbra commented 8 years ago

What does the AA stand for? Do we need to calculate anything for that? Or do you only want to have it highlighted as the rest of the color code?

omeid commented 8 years ago

Alpha :)

chrisbra commented 8 years ago

Can you please check latest commit?

omeid commented 8 years ago

Well do later today. Thanks for looking into this!

Sent from my iPhone

On 25 Aug 2016, at 6:13 AM, Christian Brabandt notifications@github.com wrote:

Can you please check latest commit?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

omeid commented 8 years ago

Works great. Thanks!