1j01 / textual-paint

:art: MS Paint in your terminal.
https://pypi.org/project/textual-paint/
MIT License
929 stars 12 forks source link

Consider adding support for sixels? #1

Open fragglet opened 11 months ago

fragglet commented 11 months ago

https://en.wikipedia.org/wiki/Sixel

1j01 commented 11 months ago

I want this for the Thumbnail view. Sixel support is on the Textual roadmap, but I haven't explored whether it's possible to do without direct support from the framework.

For the canvas itself, it could show more detail, but the mouse position granularity would still be a cell (unless there are some other terminal protocol extensions), so it wouldn't be very useful for drawing.*

*I did have this idea which wouldn't work over SSH, but when running locally it could query for the system mouse position, and correlate it with the cell position received on the terminal, in order to track sub-cell mouse movements, but this would make it less terminal-native. Also this would be complicated by the latency between mouse movement and the terminal control codes received.

For the tool buttons, it could work quite nicely to replace the emoji with proper icons. I would make this optional, like I have with --ascii-only-icons. Other icons in the app could use this too, although I'm quite happy with what I've been able to achieve with Unicode text art (at least as it renders in Ubuntu's Terminal, which has nice geometric character rendering), and I feel like it's part of the charm. I'm also planning to allow picking between different emoji/symbols for each tool, since some cause problems on different systems (tofu, and misalignment of the row of text to the right of the character), and I already have a character picker window I could use.

daviewales commented 11 months ago

Not sure if this is relevant, but looking at the xterm docs for extended mouse coordinates:

SGR-Pixels (1016) Use the same mouse response format as the 1006 control, but report position in pixels rather than character cells.