Skip to content

Use Custom Color in 256 color terminal #21

@habdig7oficial

Description

@habdig7oficial

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions