ncurses icon indicating copy to clipboard operation
ncurses copied to clipboard

Use Custom Color in 256 color terminal

Open habdig7oficial opened this issue 1 year ago • 0 comments

Hello I'm new to crystal and NCurses so maybe maybe is something wrong with my code

Objective

use all 256 colors of the terminal or create a custom color like: Color::Lime = 10

Demonstration

I altered the file src/lib_ncurses.cr adding the color i needed inside the color struct like this and it worked. image

image

However if i try to do that inside the program it returns a compile error enum LibNCurses::Color Lime = 10 end image

Proposal

I would like to know how I can define new predefined color value or at least use raw Int32 values to the init_color_pair function, that only support statically defined LibNCurses::Color type and if It's not possible in the current state of the program make a few alterations and submit a pull request in your github

I'm still thinking the best approach but make the init_color_pair function support Int overloads sound the simplest solution to me. I tried and it seems to work but I don't know if it has security issues or affects the program in other unexpected way, so I would like to know your ideas about this problem

image

Thank You in advance

habdig7oficial avatar Jun 15 '24 04:06 habdig7oficial