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

Add option for color search #360

Open
NormanTUD opened this issue Aug 29, 2022 · 2 comments
Open

Add option for color search #360

NormanTUD opened this issue Aug 29, 2022 · 2 comments

Comments

@NormanTUD
Copy link

An idea that I had that would be very useful and kind of straightforward to implement (still lots of special cases sadly) would be a color search.

Let's say I enter

ack --colorsearch "#ff0000"

and internally it searches for red, #f00, #ff0000, rgb(255, 0, 0), ...

This would be greatly appreciated I think!

@petdance
Copy link
Collaborator

Thanks for the idea. That's a pretty specific use case that has an awful lot of edge cases. I think it might be easier for you to implement it yourself with shell aliases.

Maybe you'd want a shell script wrapper around ack that was able to take a color and make those different patterns, so that if you typed

colorack ffcc22

it would translate that to

ack '(#fc2\b|#ffcc22\b|\brgb\(\s*255\s*,\s*204\s*,\s*34\s*\))'

ack by design does not know anything about the text it's searching.

@n1vux
Copy link
Contributor

n1vux commented Aug 29, 2022

Hmm, maybe I'll add this to #Cookbook beyondgrep/website#103

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

3 participants