All Projects → Pronin1986 → fmtc

Pronin1986 / fmtc

Licence: MIT license
fmtc overrides print functions of the fmt package and add ability to coloring the console output in the HTML-style

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to fmtc

zprint-clj
Node.js wrapper for ZPrint Clojure source code formatter
Stars: ✭ 13 (-13.33%)
Mutual labels:  fmt
snakefmt
The uncompromising Snakemake code formatter
Stars: ✭ 78 (+420%)
Mutual labels:  fmt
minformat
gominfmt makes the Go code more compact to aid further compression; revert with gofmt
Stars: ✭ 19 (+26.67%)
Mutual labels:  fmt

fmtc

The fmtc overrides the print functions of the fmt package, but with the ability to color output in bash using HTML tags

Available text decoration tags

<b></b>               - make font Bold
<strong></strong>     - make font Bold
<u></u>               - make text Underlined
<dim></dim>           - make font Dim
<reverse></reverse>   - Reverse background and font color
<blink></blink>       - make text Blink (not working on Mint/Ubuntu)
<black></black>       - set font color Black (Dark)
<red></red>           - set font color Red
<green></green>       - set font color Green
<yellow></yellow>     - set font color Yellow
<blue></blue>         - set font color Blue
<magenta></magenta>   - set font color Magenta
<cyan></cyan>         - set font color Cyan
<grey></grey>         - set font color Grey (Smokey)
<white></white>       - set font color White

Available background colors tags:

<bg color="black"></bg> 	- black background color
<bg color="red"></bg> 		- red background color
<bg color="green"></bg> 	- green background color
<bg color="yellow"></bg> 	- yellow background color
<bg color="blue"></bg> 		- blue background color
<bg color="magenta"></bg> 	- magenta background color
<bg color="cyan"></bg> 		- cyan background color
<bg color="grey"></bg> 		- grey background color
<bg color="white"></bg> 	- white background color

<b_black></b_black> 		- black background color
<b_red></b_red>		 	- red background color
<b_green></b_green>		- green background color
<b_yellow></b_yellow>		- yellow background color
<b_blue></b_blue>		- blue background color
<b_magenta></b_magenta>		- magenta background color
<b_cyan></b_cyan>		- cyan background color
<b_grey></b_grey>		- grey background color
<b_white></b_white>		- white background color

Install:

go get github.com/Pronin1986/fmtc

Usage:

fmtc.Print(`<b>HELLO <blue>BLUE</blue> <bg color="green">TEXT</bg></b>`)
fmtc.Println(`<b>HELLO <blue>BLUE</blue> <bg color="green">TEXT</bg></b>`)
fmtc.Printf(`<b>%v <blue>%v</blue> <bg color="green">%v</bg></b>`, "HELLO", "BLUE", "TEXT")
got: = fmtc.Sprint(`<b>HELLO <blue>BLUE</blue> <bg color="green">TEXT</bg></b>`)
got = fmtc.Sprintln(`<b>HELLO <blue>BLUE</blue> <bg color="green">TEXT</bg></b>`)
got = fmtc.Sprintf(`<b>%v <blue>%v</blue> <bg color="green">%v</bg></b>`, "HELLO", "BLUE", "TEXT")
buf := new(bytes.Buffer)
fmtc.Fprint(buf, `<b>HELLO <blue>BLUE</blue> <bg color="green">TEXT</bg></b>`)
fmtc.Fprintln(buf, `<b>HELLO <blue>BLUE</blue> <bg color="green">TEXT</bg></b>`)
fmtc.Fprintf(buf, `<b>%v <blue>%v</blue> <bg color="green">%v</bg></b>`, "HELLO", "BLUE", "TEXT")

You have already decorated text for console output like a picture above:

UsageExampleResult

Example:

package main

import (
	"fmt"

	"github.com/Pronin1986/fmtc"
)

func main() {
	fmt.Println("HELLO WORLD")
	fmtc.Println("<b>HELLO <blue>WORLD</blue></b>")
}

ExampleResult

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].