Module: RBText::Colors
- Defined in:
- lib/rbtext/colors.rb
Class Method Summary collapse
Class Method Details
.bg_color_codes ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/rbtext/colors.rb', line 24 def bg_color_codes bg_color_codes = {} for c in self.fg_color_codes.keys do bg_color_codes[c] = (self.fg_color_codes[c].to_i + 10).to_s end return bg_color_codes end |
.color(color, type: :fg) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/rbtext/colors.rb', line 34 def color(color, type: :fg) if type == :fg color_code = self.fg_color_codes[color.to_sym] elsif type == :bg color_code = self.bg_color_codes[color.to_sym] end return "\033[#{color_code}m" end |
.fg_color_codes ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rbtext/colors.rb', line 3 def fg_color_codes { black: "30", red: "31", green: "32", yellow: "33", blue: "34", magenta: "35", cyan: "36", light_gray: "37", gray: "90", light_red: "91", light_green: "92", light_yellow: "93", light_blue: "94", light_magenta: "95", light_cyan: "96", white: "97" } end |