lib/ruco/screen.rb in ruco-0.2.0.beta12 vs lib/ruco/screen.rb in ruco-0.2.0
- old
+ new
@@ -72,11 +72,11 @@
if_line_changes line_number, [line, styles] do
# position at start of line and draw
Curses.setpos(line_number,0)
Ruco::StyleMap.styled(line, styles).each do |style, part|
- Curses.attrset self.class.curses_style(style)
+ Curses.attrset self.class.curses_style(style, $ruco_colors)
Curses.addstr part
end
if @options[:debug_cache]
write(line_number, 0, (rand(899)+100).to_s)
@@ -89,11 +89,11 @@
return if @cache[key] == args # would not change the line -> nothing to do
@cache[key] = args # store current line
yield # render the line
end
- def self.curses_style(style)
- if $ruco_colors
+ def self.curses_style(style, colors)
+ if colors
foreground = $ruco_foreground || '#ffffff'
background = $ruco_background || '#000000'
foreground, background = if style == :normal
[foreground, background]