module Honcho::Colors

Constants

COLORS

Public Instance Methods

assign_colors_for_ansi() click to toggle source
# File lib/honcho/colors.rb, line 30
def assign_colors_for_ansi
  colors = COLORS.dup
  apps.keys.each_with_object({}) do |app, hash|
    (curses_color_code, curses_color_quality) = colors.shift
    bold = curses_color_quality == Curses::A_BOLD ? 1 : 0
    hash[app] = "#{bold};3#{curses_color_code}"
  end
end
assign_colors_for_curses() click to toggle source
# File lib/honcho/colors.rb, line 20
def assign_colors_for_curses
  COLORS.each_with_index do |(color, _), index|
    Curses.init_pair(index + 1, color, Curses::COLOR_BLACK)
  end
  apps.keys.each_with_index.each_with_object({}) do |(app, index), hash|
    (_, quality) = COLORS[index]
    hash[app] = [index + 1, quality]
  end
end