sharkdp / pastel

A command-line tool to generate, analyze, convert and manipulate colors
Apache License 2.0
5.04k stars 97 forks source link

Add Lab format (to parser and output) #3

Closed sharkdp closed 4 years ago

sharkdp commented 5 years ago
shawnohare commented 5 years ago

Is CIELab format parseable now? I notice only the output task has been checked. I was excited to use this tool, but pastel could not parse the CIELab format as of a fresh install yesterday.

sharkdp commented 5 years ago

The reason I closed this ticket is that conversion from Lab (to RGB) can be confusing because you can easily reach the edge of RGB space (fully saturated colors), because the sRGB gamut has such a weird shape in Lab space.

In any case, that's not really a reason not to implement this. We should add this.

This should be really straightforward to implement, as we already have Color::from_lab. It just needs a simple Regex in src/cli/parser.rs.

saidsay-so commented 4 years ago

Hi! I tried to parse this format but there isn't a string to distinguish them (like HSL() or RGB()) so I just use the prefix CEILab(). Is it good?

sharkdp commented 4 years ago

@MusiKid Thank you for looking into this. I think it would be great if we could support both CIELab(…) (not CEI…) as well as Lab(…), case insensitive.

Regex could be something like (cie)?lab\(…

saidsay-so commented 4 years ago

Oh yes, sorry! It's effectively CIELAB. And I think that the regex should be more like (?:cie)?lab\( because we don't need to capture this group.

sharkdp commented 4 years ago

closed via #101 by @MusiKid