sharkdp / pastel

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

Allow drawn text to be colored based on pixels that are in that location #107

Closed JuanPotato closed 2 years ago

JuanPotato commented 4 years ago

Text takes up two "rows" of pixels in the hdcanvas. We could use this to add colored drawn text and treat the first row as the foreground and the second as the background.

As an example usage (not added in this PR): image

sharkdp commented 4 years ago

Thank you very much for your contribution.

Text takes up two "rows" of pixels in the hdcanvas. We could use this to add colored drawn text and treat the first row as the foreground and the second as the background.

That's clever, but I don't think we need to be worried about memory here. I'd rather change the representation of the characters to:

  chars: Vec<Option<CharWithStyle>>,

where CharWithStyle would be something like

struct CharWithStyle(char, Option<Style>);
JuanPotato commented 4 years ago

Yeah, that definitely seems easier to use

sharkdp commented 2 years ago

Closing for now since this is rather old. We can always resurrect it later.