-
Notifications
You must be signed in to change notification settings - Fork 52
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
Support 24bit colors #69
Comments
I have experimented a bit with RGB coloring in cpp-terminal and it's going well so far. I have created the function I would so it like this:
What do you think about that? I have also checked, if I'll look into the color struct of the window class next. |
We can have a function for Great job a the 24 bit colors. Something like what you did should work! |
Yeah! I'll do the changes inside of the window class next. I would also take that opportunity to create a "test" example for the terminal tests, it would include all features of cpp-terminal so we can easily determine which terminals are supporting which things / colors. Also I would like to either add colors24 to the readme or move the color part from the readme into a section of the wiki. What do you think? |
That all looks like a great plan. I would leave |
I have started to edit the parts in the Window class. Your Color struct is not compiling at all due to the -Wall compiler flag, because ISO C++ forbids anonymous structures and unions inside of structures. The correct way to do that is to create the color type enum separately, as well as the rgb struct and create a union to group the 4bit and 24bit colors together. Just have to change a bit because I cant initilize a vector holding a struct like you did with the normal vectors |
Sounds good. Let me know if you need help. |
A small update: I have tried a few ideas to implement the colors inside of the window class. 24bit color is really complicated, as we can't just re-use all of the code already there. Also the render function gets really blown as we have to check for the tag vector all the time and make big if monsters. I would suggest to simply make it two classes (like |
Also: the window demo crashes my visual studio code integrated terminal and has some color issues inside of it. That might be a problem on other Terminal as well (just the window example though). We should test that in #73 as well to be safe. It is possible, that the visual studio terminal has some problems, because the same binary just works perfectly fine on my normal terminal (Kitty). I open a separate issue on that one! |
Currently
cpp-terminal
only supports 4bit colors. We should extend it to also support 24 bit colors:https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit
We have to add a new function
color_24bit
(similar to the current functioncolor
which is only 4 bit) and use theESC[ 38;2;⟨r⟩;⟨g⟩;⟨b⟩ m
sequence to set it.Then we need to extend the
Window
class, currently the color is only represented by the 3bit colorvector<fg>
. Instead we have to change it tovector<Color>
, where theColor
struct is something like this:and then the
set_fg
method would become:Also the
render
method would need to be updated.The text was updated successfully, but these errors were encountered: