diff --git a/examples/colors.cr b/examples/colors.cr index ad10696..415a633 100644 --- a/examples/colors.cr +++ b/examples/colors.cr @@ -16,6 +16,7 @@ NCurses.init_color_pair(1, NCurses::Color::Red, NCurses::Color::Green) NCurses.init_color_pair(2, NCurses::Color::Blue, NCurses::Color::Black) NCurses.init_color_pair(3, NCurses::Color::Black, NCurses::Color::White) NCurses.init_color_pair(4, NCurses::Color::Cyan, NCurses::Color::Magenta) +NCurses.init_color_pair(5, 208, 0) # Change color RGB values if terminal supports it if NCurses.can_change_color? @@ -42,6 +43,11 @@ NCurses.set_color 4 NCurses.print "\nThis should appear to be white on black\n" NCurses.print "But color pair 4 is cyan on magenta\n" +NCurses.set_color 5 + +NCurses.print "\nAnd you can pass raw X-term colors\n" +NCurses.print "This is a orange text" + NCurses.set_color NCurses.print "\nPress q to exit\n" diff --git a/src/ncurses.cr b/src/ncurses.cr index a723bf8..32b747e 100644 --- a/src/ncurses.cr +++ b/src/ncurses.cr @@ -245,7 +245,7 @@ module NCurses # init_color_pair 5, Color::Red, Color::Blue # => Color pair 5 is not red on black # ``` # Wrapper for `init_pair()` - def init_color_pair(slot, foreground : Color, background : Color) + def init_color_pair(slot, foreground : (Color | UInt8), background : (Color| UInt8)) raise "init_pair error" if LibNCurses.init_pair(slot.to_i16, foreground.to_i16, background.to_i16) == ERR end