Skip to content

--invert does not produce equivalent output with 2-color block symbol setsΒ #323

@badele

Description

@badele

I am trying to work with ANSI block characters compatible with CP437, for example:

[ β–‘β–’β–“β–ˆ]

In some situations, I prefer the background to be rendered with spaces " ", and in others with the full block "β–ˆ". That is why I find the --invert option very useful.

However, based on the output, --invert does not seem to reproduce the same image with inverted colors. Visually, the result looks different, not just color-inverted.

In theory, in strict 2-color mode, using a symbol set like:

[ β–ˆ]

should produce the same image when inverted (except that foreground and background colors are swapped).

Here is a minimal example that shows the issue:

test -f Flower_yellow_and_green.png || wget https://upload.wikimedia.org/wikipedia/commons/e/e4/Flower_yellow_and_green.png
chafa -f symbols --symbols "[ β–ˆ]" --fill "[ β–ˆ]" --colors 2 --color-space din99d --font-ratio 0.5 -w 5 --size 60 Flower_yellow_and_green.png
chafa -f symbols --symbols "[ β–ˆ]" --fill "[ β–ˆ]" --invert --colors 2 --color-space din99d --font-ratio 0.5 -w 5 --size 60 Flower_yellow_and_green.png
chafa -f symbols --symbols "[ β–ˆ]" --fill "[ β–ˆ]" --colors 16/8 --color-space din99d --font-ratio 0.5 -w 5 --size 60 Flower_yellow_and_green.png
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as advertisedqualityOutput quality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions