Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.

how to configure chafa image viewer to show images within vifm (w/o image defects)

0 votes
asked Feb 2 in vifm by jose1711

i am trying to configure chafa as an image-viewer. this is in my vifmrc:
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm chafa --clear -c 256 --bg blue %c

TERM variable is set to xterm-256color. the result is OK but not perfect as image artefacts appear in different places. (https://i.imgur.com/t4Jlwzb.png)

1 Answer

0 votes
answered Feb 2 by xaizek
edited Feb 2 by xaizek

If the image looks better in the same terminal outside vifm, then this is probably a result of limited number of color pairs. curses library (except for some recent versions, which do it in backwards incompatible way, I think) limits how many foreground-background pairs it can handle for historical reasons. And vifm can't work around it except for supporting newer curses API, which might lift this limitation on systems where it's available. Currently that API isn't supported.


UPDATE: the limit is at most 256 color pairs unless ncurses is configured with --enable-ext-colors, which is on by default since ncurses6, but is present since ncurses5.5. It looks like support for it can be added with some code change.

commented Feb 2 by jose1711

thank you, the issue has also been reported at chafa github page: https://github.com/hpjansson/chafa/issues/26

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...