piotrmurach/tty

suggestion: banner

gurgeous opened this issue · 2 comments

It would be great to support banners. We use this a lot in our scripts.

image

That sounds useful, I would be interested in the api, do you have any code examples to show?

Sure - note that the ANSI colors are defined as constants. I'd be happy to wrap this up as a PR that uses pastel if you give me a bit of direction. :)

def banner(str, color: GREEN)
  now = Time.new.strftime("%H:%M:%S")
  s = "#{str} ".ljust(72, " ")
  puts "#{color}[#{now}] #{s}#{RESET}"
end

and usage:

banner("Factoring primes...")