Giter Club home page Giter Club logo

Comments (4)

trygveaa avatar trygveaa commented on June 14, 2024

This isn't possible to add support for with the current UI library that WeeChat uses, ncurses. It handles all text printing to the terminal and doesn't have a way to include an escape character in a text string. The reason for that is that it needs to understand the escape sequences in order to do text wrapping, side panels etc. If it would have been possible you would encounter issues such as color/links bleeding into the nicklist (when you have it on the right side as default).

It is possible to send escape sequences directly to the terminal, separately from any text in the UI though. This means you can't use it for colors or links, as the text for that would just appear where the cursor is, independently of any UI elements or the buffer you're in, and cleared when the UI is redrawn. But it can be used to e.g. send escape sequences for desktop notifications or with some limitations show images (either on top of the UI independently of it, or in the UI by using unicode placeholders).

To send escape sequences directly to the terminal, just write directly to /dev/tty.
Here's an example in bash: https://gist.github.com/trygveaa/e304621f53c62c792864faeedfddb86b
And here's an example in a WeeChat Python script: https://github.com/trygveaa/weechat-icat/blob/ece458c6c17c00dab6fe5a7a4fc57c204d7a72b5/weechat_icat/terminal_graphics.py#L237-L240

from weechat.

necauqua avatar necauqua commented on June 14, 2024

Ooh, I see, it seems like I did not quite realise what exactly the limitation was with ncurses, thanks for the detailed explanation.

Looks like best I could do atm is to coarse the #rrggbb into the 256-color palette, oh well

from weechat.

trygveaa avatar trygveaa commented on June 14, 2024

Looks like best I could do atm is to coarse the #rrggbb into the 256-color palette, oh well

WeeChat already has a function for this btw. color_rgb2term in info_get.

from weechat.

necauqua avatar necauqua commented on June 14, 2024

Oh, calling that is.. significantly less code than what I've cooked up (that's code for "stole from tmux") already, thanks again :)

from weechat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.