Browse Source

colored tags

main
pvincent 2 months ago
parent
commit
70950ee00f
  1. 4
      lib/semantic/ansi_formatter.rb

4
lib/semantic/ansi_formatter.rb

@ -48,7 +48,7 @@ module Semantic
def tags def tags
first_tag = log.tags.empty? ? 'none' : log.tags.first first_tag = log.tags.empty? ? 'none' : log.tags.first
first_tag.truncate(CENTER_SIZE).center(CENTER_SIZE)
colorize(centerize(first_tag, 10), AnsiColors::BG_GRAY + AnsiColors::DARK_TEXT_YELLOW)
end end
def named_tags def named_tags
@ -182,7 +182,7 @@ module Semantic
def build_prefix(char) = "#{tags} #{origin}#{colorize(char)}" def build_prefix(char) = "#{tags} #{origin}#{colorize(char)}"
def build_terminus = "#{tags} #{origin} #{TERMINUS_STRING} " def build_terminus = "#{tags} #{origin} #{TERMINUS_STRING} "
def colorize(text, tint = color) = "#{tint}#{text}#{CLEAR}" def colorize(text, tint = color) = "#{tint}#{text}#{CLEAR}"
def centerize(text) = text.reverse.truncate(CENTER_SIZE).reverse.center(CENTER_SIZE)
def centerize(text, max_length = CENTER_SIZE) = text.reverse.truncate(max_length).reverse.center(max_length)
def stackisize(items) def stackisize(items)
return '' if items.empty? return '' if items.empty?

Loading…
Cancel
Save