spellr / culour

Print colored strings in curses windows easily
GNU General Public License v3.0
15 stars 2 forks source link

Support for more ANSI color codes #5

Closed frun36 closed 2 weeks ago

frun36 commented 2 months ago

Hi! Why aren't more ANSI color codes supported? In particular, I'm missing the remaining 3 colors from the most typical 8 colors (see https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#8-16-colors).

class TerminalColors(object):
    MAGENTA = '[95'
    BLUE = '[94'
    GREEN = '[92'
    YELLOW = '[93'
    RED = '[91'
    END = '[0'

Misses CYAN, BLACK, WHITE.

spellr commented 2 months ago

Hey, I'm happy to know someone is using this package. I'm happy to accept pull requests

Hierosme commented 1 month ago

Hello,

I just ping...

The approch of culour is static because NCurses use same default color, that is a perfect match with NCurses. Clearly not culour fault

If we speach about more of default NCurses color, then a static approch require 256 colors for forground and 256 colors for background (with special cases like for background ALPHA (must be color pair 0)). Then can can generate (256 * 256) colors pair.

Technical info Normaly ANSII color ar a 7bits color, the static approch can easilly be translate to logic 7bits, and match with default couler approch.,

NCurses have a function for speack about RGB where (R: range(0, 1000), G: range(0, 1000), B: range(0, 1000)), then can back to a 255 max.

The 256 colors type is a xterm technology, that is a 8bits logic and permit a True RGB approch.

Why 7Bits or 8Bits ? : On 7Bits a octet is resever for color call blink (use by the cursor prompt), on 8Bits approch the blink color do not exist any more, then you can use that octet for better color range. Then 256 colors.

I have to devellop a 256 colors methods for a TUI project to we want it here ?

spellr commented 2 weeks ago

@Hierosme I'm not sure I understand your comment. Let's move it to a new issue, as this issue was resolved

spellr commented 2 weeks ago

resolved with #6