Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a great hack, but it makes bad sparklines. It’s probably about as good as you can get with unicode, so props to Jon.

Sparklines have a few important properties which these do not exhibit. They’re typically higher resolution, with more data per inch. Also the slopes from point to point, and the whitespace under the typical graph/sparkline, help readability.



One can use Braille characters to get slightly more negative space and horizontal resolution, at the cost of vertical resolution. (They are 2×4 blocks IIRC.)


If anyone want to see an example of graphing use the braille characters (I think) look at btop https://github.com/aristocratos/btop

Speaking of misaligned characters: an upgrade a few months back in some thing (font, terminal, or renderer) caused the characters to be shifted up or down one pixel so the bottom and top now touch between lines


I recently had to look at the implementation of the Sparkline [1] widget in Ratatui which uses a similar Unicode technique but scales nicely for sparklines with larger vertical size.

[1] https://github.com/ratatui/ratatui/blob/20c88aaa5b9eb011a522...


Maybe we need terminal escape codes to temporarily switch to linked alternative fonts. ;)


There are already several escape sequences for doing just this. In fact the original way of drawing terminal graphics was using a 7bit escape sequence to switch to a terminal graphics font.

Personally I’d rather see in-lined vector graphics become better supported. This was available on some of the Techtonix (iirc) hardware VTs and as far as I know, the only widespread terminal emulator to support that particular mode is xterm.


Isn't that more like switching to a different character set, with supporting fonts having to be already present? Or what are you referring to?

I was thinking along the lines of online (or inline) fonts, similar to web fonts in CSS, which would allow for arbitrary custom glyphs.


Sixel graphics on the vt220 (1983) worked by defining a custom font of 10x10 px characters (9x10 in high-resolution mode), which you could then switch to for any given character.

As far as I know, there is no terminal emulator that supports this flavor if sixel graphics.


Congratulations on reinventing sixels. :)


Sixel is different. It’s a way of drawing graphics rather than switching to alternative character sets.

Sixels could be used here too, but native support for vector graphics would be nicer.

I’m also of the opinion that sixel sucks as a modern option. It’s got a low DPI resolution, cannot be compressed, and is its own bespoke specification which means lots of additional work for terminal maintainers. Which is why most terms these days go with their own escape sequences for natively supporting common formats like PNG and JPEG.

In my own terminal emulator, I’ve got support for several image formats but I doubt I’ll ever bother with sixel.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: