Skip to content
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

Invalid colors are also highlighted #31

Closed
webextensions opened this issue Jan 19, 2019 · 4 comments
Closed

Invalid colors are also highlighted #31

webextensions opened this issue Jan 19, 2019 · 4 comments

Comments

@webextensions
Copy link
Contributor

Describe the bug
Even if you type invalid color code, it would still highlight it as a color in CodeMirror.
For example: Type "#000a" and it would show up as black color.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://colorpicker.easylogic.studio/#codemirror-colorpicker-addon
  2. Click on the editor inside "CodeMirror ColorPicker Addon"
  3. Type "#000a" (without quotes)
  4. It would show up as a color

Expected behavior
Invalid hex codes should not be identified as colors.

Screenshots
This is the screenshot for my browser extension where I face the same issue:
https://user-images.githubusercontent.com/29383712/51375676-d0e60500-1b06-11e9-83b2-701de05752ac.png
Reference: webextensions/live-css-editor#23 (comment)

Desktop (please complete the following information):

  • OS: Any
  • Browser: Any
  • Version: 1.9.49

Smartphone (please complete the following information):

  • Device: Not tested
  • OS: Not tested
  • Browser: Not tested
  • Version: Not tested

Additional context
I would recommend that if a hex code (or valid color) is immediately followed by a whitespace / single-quote / double-quote character / etc, then only it should be considered as a valid color. Otherwise, treat it as an invalid color and don't highlight it.

@easylogic
Copy link
Collaborator

thank you for reporting, @webextensions

I checked it.

I'll let you know when it's fixed.

@easylogic
Copy link
Collaborator

easylogic commented Jan 19, 2019

@webextensions

I have some problem.

CodeMirror's token is not exactly.

For example,

#d34-background {
    blue: blue; 
}

#d34 and first blue are that token type is null.

The problem is that last blue's token type is also null.

So it will take some time for this to be resolved.

@easylogic
Copy link
Collaborator

@webextensions

I released v1.9.50

please test it.

@webextensions
Copy link
Contributor Author

@easylogic
Thanks. I'll try it and update the usage in my extension :-)

Closing the issue since it seems to work fine on your demo page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants