diff --git a/README.md b/README.md index d610615..27cf79e 100644 --- a/README.md +++ b/README.md @@ -79,3 +79,4 @@ $ crystal run examples/scroll.cr - (https://github.com/jreinert) Joakim Reinert - creator, maintainer - (https://github.com/SamualLB) Samual Black - maintainer +- (https://github.com/data-niklas) Niklas Loeser - contributor diff --git a/examples/colors.cr b/examples/colors.cr index ad10696..0dbf94f 100644 --- a/examples/colors.cr +++ b/examples/colors.cr @@ -10,6 +10,7 @@ unless NCurses.has_colors? exit(1) end +NCurses.default_colors NCurses.start_color NCurses.init_color_pair(1, NCurses::Color::Red, NCurses::Color::Green) diff --git a/shard.yml b/shard.yml index 5cd0dac..432778a 100644 --- a/shard.yml +++ b/shard.yml @@ -1,9 +1,11 @@ name: ncurses + version: 1.1.0 authors: - Joakim Reinert - Samual Black + - Niklas Loeser crystal: 1.0.0 diff --git a/src/lib_ncurses.cr b/src/lib_ncurses.cr index c98d44e..2c2279f 100644 --- a/src/lib_ncurses.cr +++ b/src/lib_ncurses.cr @@ -117,6 +117,7 @@ lib LibNCurses fun can_change_color : Bool fun init_color(slot : LibC::Short, red : LibC::Short, green : LibC::Short, blue : LibC::Short) : LibC::Int fun init_pair(slot : LibC::Short, foreground : LibC::Short, background : LibC::Short) : LibC::Int + fun use_default_colors() # Output options fun clearok(window : Window, bf : Bool) : LibC::Int diff --git a/src/ncurses.cr b/src/ncurses.cr index a723bf8..5442fcf 100644 --- a/src/ncurses.cr +++ b/src/ncurses.cr @@ -249,6 +249,18 @@ module NCurses raise "init_pair error" if LibNCurses.init_pair(slot.to_i16, foreground.to_i16, background.to_i16) == ERR end + + # Use the default terminal colors + # Takes no arguments and has no result + def use_default_colors + LibNCurses.use_default_colors + end + + # Alias for use_default_colors + def default_colors + use_default_colors + end + # # ## Other #