Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

256-Colo(u?)r support #4

Open
shabble opened this issue Apr 20, 2011 · 5 comments
Open

256-Colo(u?)r support #4

shabble opened this issue Apr 20, 2011 · 5 comments

Comments

@shabble
Copy link
Owner

shabble commented Apr 20, 2011

Currently, Irssi only supports 8 colours (16 if you count bright ones). Buidling Ncurses with --enable-ext-colors allows for
256 foreground and background colors (assumign a supporting terminal), which would allow for much more configurability in themes, etc.

Notes from a prior conversion:
<+ferret> in src/fe-text/term-terminfo.c:set_term_colors() the colour argument is an integer with lowest 4 bits for the foreground color and 5th-8th bits for the background colour <+ferret> that would need to be changed to 1-8 and 9-16 <+ferret> or split into two vars (I mean, come on? Why compress data that way?) <+ferret> Ahh... the upper 8 bits are also used for things like blink <+ferret> So you would definitely need to either make that var bigger or add another one <+ferret> Other than that the code doesn't look too hard to implement <+shabble> think of all the extra %num special vars you'd need! <+ferret> The money shot is in src/fe-text/terminfo-core.c, where you change terminfo_setup_colors to respect 256 color term environment and config option, setting term->TI_colors to 256 <+ferret> It creates an array of strings of either 8 or 256 colour entries, either returned from the setaf tput function or force generated as \e[%dm <+ferret> As a refinement you'd probably want to come up with a way of mapping the 256 entries to the basic 8 colours in the case the terminal doesn't support it. Code for that can be ripped from screen :D <+ferret> Yeah, there is that... but the formats parsing isn't particularly critical anyway, and you can make it greedy without causing too many problems. Just create a new %X where X is a letter that has two following bytes which are interpreted as hex in the range 0..255. Another letter for background colour. <+shabble> that could work <+shabble> although I suspect many things will assume % is only followed by a single char <+ferret> Let's find out. <+shabble> looks like fe-common/core/themes.c where it gets processed <+ferret> Nah <+ferret> There's no big switch statement in there <+ferret> There should be one :> <+ferret> It's in formats.c in the same directory <+shabble> ah, formats.c

@richo
Copy link

richo commented Apr 20, 2011

While you're at it, you only have 8 color choices for backgrounds in statusbars (no bright/dull distinction)

Post 256 color support would all colors just be RGB values, with optional shorthand like what's in place?

@shabble
Copy link
Owner Author

shabble commented Apr 21, 2011

My understanding so far is that you can have 256 colours for both fore- and backgrounds, givng you 65k colour pairs.

My current thinking is to keep the existing % colour escapes, and add something like %xddd and %Xddd for foreground and background colours respectively. I have some demo code (from http://www.frexx.de/xterm-256-notes/ ) which demonstrates using NCurses to produce 32k colour pairs, plus a bold/underline, etc.

That's the idea, anyway. Actual implementation may change how it has to work.

@pd0mz
Copy link

pd0mz commented Apr 5, 2013

Bump! C'mon irssi team, it's 2013 👍

@ekix
Copy link

ekix commented Jun 13, 2013

I would love to see 256 color support for Irssi.

@ailin-nemui
Copy link

ahf/irssi#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants