Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions examples/colors.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: ncurses

version: 1.1.0

authors:
- Joakim Reinert <[email protected]>
- Samual Black <[email protected]>
- Niklas Loeser <[email protected]>

crystal: 1.0.0

Expand Down
1 change: 1 addition & 0 deletions src/lib_ncurses.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/ncurses.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down