6 so..the good news is that reading the source code for lua-term is actually very easy thus copying that wasn't hard.
However, this did make me feel a bit bad as I feared it would end up as a straight copy.
Luckily, bash is so nice that going above 16 colors I need a different order of characters to compose them.
In order to explain what I mean an example is probably the best. In order to create black text I write
Here the number 30 is telling the terminal that I want black text.
However, if I want to access more than 16 colors the pattern suddenly becomes
Code:
\e[38;5;ColorNumberm
//so..something like
\e[38;5;30m
And, no that will not make black text. It will actually make some greenish/blueish text. If I want black text with this pattern I should replace the 30 with either a 0a 16 or a 232. Note that going higher than 232 will make gray to white text.
So... I think I'm going to structure my color api a bit different. Mainly by being able to use numbers, compose colors and using their raw numbers as well as making names for the most used ones.
Basically allowing me to write
Code:
local colorFun = colors:make():foreground(colors.RED):background(colors:BLACK):attr(colors.BOLD,true):comp()
print(colorFun("some Text")) --will print bolded red text on a black background.
If I do it right it should result in better code overall and may even make it easier for me to work with the background color in combination with transparency.