X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fsup%2Fcolormap.rb;h=fbbbfc9e9405d1be3eb88d4dd647b6e96e9e85d8;hb=bf30feea5c29d1aa5c1b8bbefa2bf4f4e73b1510;hp=fe60f61362a5d65cd3abe22d4fcfbf8bc21d26c2;hpb=5088681ea1f8b2d054eb6b8bdc3ecc4ef8e22dfb;p=sup diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index fe60f61..fbbbfc9 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -11,7 +11,7 @@ class Colormap Curses::COLOR_YELLOW, Curses::COLOR_BLUE, Curses::COLOR_MAGENTA, Curses::COLOR_CYAN, Curses::COLOR_WHITE, Curses::COLOR_DEFAULT] - NUM_COLORS = 15 + NUM_COLORS = (CURSES_COLORS.size - 1) * (CURSES_COLORS.size - 1) DEFAULT_COLORS = { :status => { :fg => "white", :bg => "blue", :attrs => ["bold"] }, @@ -129,7 +129,7 @@ class Colormap @next_id = (@next_id + 1) % NUM_COLORS @next_id += 1 if @next_id == 0 # 0 is always white on black id = @next_id - Redwood::log "colormap: for color #{sym}, using id #{id} -> #{fg}, #{bg}" + debug "colormap: for color #{sym}, using id #{id} -> #{fg}, #{bg}" Curses.init_pair id, fg, bg or raise ArgumentError, "couldn't initialize curses color pair #{fg}, #{bg} (key #{id})" @@ -137,7 +137,7 @@ class Colormap ## delete the old mapping, if it exists if @users[cp] @users[cp].each do |usym| - Redwood::log "dropping color #{usym} (#{id})" + warn "dropping color #{usym} (#{id})" @entries[usym][3] = nil end @users[cp] = [] @@ -155,7 +155,7 @@ class Colormap ## to the default ones. def populate_colormap user_colors = if File.exists? Redwood::COLOR_FN - Redwood::log "loading user colors from #{Redwood::COLOR_FN}" + debug "loading user colors from #{Redwood::COLOR_FN}" Redwood::load_yaml_obj Redwood::COLOR_FN end @@ -171,7 +171,7 @@ class Colormap fg = Curses.const_get "COLOR_#{ufg.upcase}" rescue NameError error ||= "Warning: there is no color named \"#{ufg}\", using fallback." - Redwood::log "Warning: there is no color named \"#{ufg}\"" + warn "there is no color named \"#{ufg}\"" end end @@ -180,7 +180,7 @@ class Colormap bg = Curses.const_get "COLOR_#{ubg.upcase}" rescue NameError error ||= "Warning: there is no color named \"#{ubg}\", using fallback." - Redwood::log "Warning: there is no color named \"#{ubg}\"" + warn "there is no color named \"#{ubg}\"" end end @@ -190,7 +190,7 @@ class Colormap Curses.const_get "A_#{a.upcase}" rescue NameError error ||= "Warning: there is no attribute named \"#{a}\", using fallback." - Redwood::log "Warning: there is no attribute named \"#{a}\", using fallback." + warn "there is no attribute named \"#{a}\", using fallback." end end end