lib/pastel/ansi.rb in pastel-0.5.3 vs lib/pastel/ansi.rb in pastel-0.6.0

- old
+ new

@@ -50,7 +50,21 @@ on_bright_blue: 104, on_bright_magenta: 105, on_bright_cyan: 106, on_bright_white: 107 } + + module_function + + def foreground?(code) + [*(30..37), *(90..97)].include?(code.to_i) + end + + def background?(code) + [*(40..47), *(100..107)].include?(code.to_i) + end + + def style?(code) + (1..9).include?(code.to_i) + end end # ANSI end # Pastel