Rich command-line formater for vt100.
Go to file
xdrm-brackets 8e14182645 upd readme 2019-01-25 12:22:21 +01:00
README.md upd readme 2019-01-25 12:22:21 +01:00
colors.go add 'sprintf' vs. 'printf' | add simple coloring test 2019-01-25 11:59:43 +01:00
printer.go add 'sprintf' vs. 'printf' | add simple coloring test 2019-01-25 11:59:43 +01:00
printer_test.go add 'sprintf' vs. 'printf' | add simple coloring test 2019-01-25 11:59:43 +01:00

README.md

| extended terminal format |

Go version Go Report Card Go doc

Simple utility written in go that extends the standard fmt.Sprintf and fmt.Printf functions. It allows you to set foreground/background color, bold, underlined and italic text.


(1) Format

Base format
${<target text>}(<fg>:<bg>)
  • <target text> is the text that will be colorized.

  • <fg> is the name of the foreground color (c.f. color list), or an hex color (e.g.#00ffaa, #0fa).

  • <bg> is the name of the background color with the same syntax as for the foreground.

Example
clifmt.Printf("normal text ${red text over black}(red:#000) normal text")

Note that it is not recommended to nest the different coloring formats.

Foreground only
${<target text>}(<fg>)
  • <target text> is the text that will be colorized.
  • <fg> is the name of the foreground color.
Example
clifmt.Printf("normal text ${red text}(red) normal text")
Background only
${<target text>}(:<bg>)
  • <target text> is the text that will be colorized.
  • <bg> is the name of the background color.
Example
clifmt.Printf("normal text ${text over red}(#ff0000) normal text")

(2) Screenshot

default screenshot


(3) Incoming features

  • markdown-like formatting - bold, italic, underlined, (strike-through?)
  • global alignment - align text dynamically
  • progress-line - redrawing format to show, for instance an animated progress bar on the same line