sharkdp / pastel

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

Vertical color bleed for some fonts #72

Closed rivy closed 5 years ago

rivy commented 5 years ago

🎉🥇

... a fun utility, thanks for the creative excellence!

Discussion

For some fonts, notably many of the "nerd fonts", the block characters used as "pixels" are not the pixel-perfect character width. So, for characters which are a mixture of colors, some color bleed can occur. This is most noticeable between the solid color swatch and the surrounding checkerboard. It's quite variable in appearance. Depending on the color selections, it can be unnoticeable or quite distracting.

pastel-color-bleed

Modifying the color swatch size to be offset from the checkerboard by a factor of two from the top and bottom of the checkerboard avoids this bleed effect. Since the swatch is centered on the checkerboard, its total size difference from the checkerboard size must be a factor of four (eg, 0, 4, 8, ...) to avoid the bleed effect.

I've done this in https://github.com/rivy/rust.pastel/commit/ee26fd644e4198177e80e4c53c48e8126538d4f2, but I'm hesitant to submit a PR because it changes the aesthetics of your output.

pastel-color-bleed-fixed

Alternatively, I could look at adding in some configuration option(s) which set the size of the checkerboard/swatch.

Any thoughts?

sharkdp commented 5 years ago

Thank you for the feedback and the excellent bug report.

For some fonts, notably many of the "nerd fonts", the block characters used as "pixels" are not the pixel-perfect character width.

Ah :-/ that is unfortunate...

I've done this in rivy@ee26fd6, but I'm hesitant to submit a PR because it changes the aesthetics of your output.

Hm.. I think I like the original version better, but your proposal would have the added advantage that we also save on overall vertical screen space (horizontal too, but vertical is more valuable here). That allows us to see more color swatches on a single screen (coming to think of it, we should probably also print just a single empty line between two swatches).

All of this is to say: I think I'd be okay with your change! :smile: Thank you for looking into this.

rivy commented 5 years ago

Ok, I've put a little more work into it (see https://github.com/rivy/rust.pastel/tree/wa.color-bleed). I'll put together a PR tomorrow.

rivy commented 5 years ago

Uploaded, see #75.

sharkdp commented 5 years ago

closed via #75