[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Advice for supporting custom colors

From: Bryan Christ
Subject: Advice for supporting custom colors
Date: Wed, 9 Jan 2019 13:26:28 -0600

I'm looking to add custom color support to libvterm (beyond 64 pairs and default 8 colors).  Before I dive in, I'm looking for any guidance from experts on this forum.  So please feel free to share your thoughts whether great or small.

The challenge with supporting larger colors is that the native output for libvterm is a ncurses WINDOW.  As a shared library, it assumes the color pair mappings of the program it's integrated with (the host program).  This isn't really a problem when there are only 8 colors which are rather "standard" because even the program running inside the emulator (the client app) is going to be using the same 8 colors.  That all changes when custom colors come into play.

In order to produce the highest level of color fidelity, I could capture the RGB escape codes emitted by the client app and create new colors as they come in.  However, it seems like I would have to perform some level of checks to make sure that the new color doesn't trample some color already defined by the host program.  Secondarily, even if I could figure that out, it's possible that the host program could have exhausted all of the colors within the range allowed by a "short".

Again, any and all advice is welcomed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]