Skip to content

Commit

Permalink
rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
mallvielfrass committed Mar 29, 2021
1 parent 9067867 commit 1b0d015
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module github.com/mallvielfrass/fmc

go 1.16

require (
github.com/jwalton/gchalk v1.0.3
github.com/jwalton/go-supportscolor v1.0.0
github.com/mattn/go-isatty v0.0.12
)
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github.com/jwalton/gchalk v1.0.3 h1:Eo/Ig+8efrpVpNI1ZoiJ+fLFHGXH7Q7+pBzOpG4Mib4=
github.com/jwalton/gchalk v1.0.3/go.mod h1:kmvsubrIhnHSklat2ZWNj7zlLs3SS2wGNgsBVPtill4=
github.com/jwalton/go-supportscolor v1.0.0 h1:Do3OE2y/iUibg79+QhkRE6G2evYKEv2bwi6sGs8Nd7s=
github.com/jwalton/go-supportscolor v1.0.0/go.mod h1:hFVUAZV2cWg+WFFC4v8pT2X/S2qUUBYMioBD9AINXGs=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 h1:SgQ6LNaYJU0JIuEHv9+s6EbhSCwYeAf5Yvj6lpYlqAE=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
82 changes: 82 additions & 0 deletions rewrite/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package main

import (
"fmt"

"github.com/jwalton/gchalk/pkg/ansistyles"
"github.com/jwalton/go-supportscolor"
)

///func rgb(a, x, y int) uint8 {
// s := ansistyles.RGBToAnsi256(uint8(a), uint8(x), uint8(y))
//return ansistyles.Ansi256(s)
// return s
//}

var (
//aqua = rgb(0, 255, 255)
//black = rgb(0, 0, 0)
//blue = rgb(0, 0, 255)
//fuchsia = rgb(255, 0, 255)
//gray = rgb(128, 128, 128)
//green = rgb(0, 128, 0)
//lime = rgb(0, 255, 0)
// maroon = rgb(128, 0, 0)
//navy = rgb(0, 0, 128)
//olive = rgb(128, 128, 0)
//purple = rgb(128, 0, 128)
//red = rgb(255, 0, 0)
//silver = rgb(192, 192, 192)
//teal = rgb(0, 128, 128)
//white = rgb(255, 255, 255)
//yellow = rgb(255, 255, 0)
aqua = ansistyles.Ansi256(51)
black = ansistyles.Ansi256(16)
blue = ansistyles.Ansi256(21)
fuchsia = ansistyles.Ansi256(201)
gray = ansistyles.Ansi256(244)
green = ansistyles.Ansi256(34)
lime = ansistyles.Ansi256(46)
maroon = ansistyles.Ansi256(124)
navy = ansistyles.Ansi256(19)
olive = ansistyles.Ansi256(142)
purple = ansistyles.Ansi256(127)
red = ansistyles.Ansi256(196)
silver = ansistyles.Ansi256(250)
teal = ansistyles.Ansi256(37)
white = ansistyles.Ansi256(231)
yellow = ansistyles.Ansi256(226)
reset = "\x1b[39m"
)

func bold(word string) string {
return "\033[1m" + word + "\033[0m"

}
func format(c, word string) string {

return c + word + reset
}
func main() {
supportscolor.Stdout()

fmt.Printf("color: %s\n", format(aqua, "aqua"))
fmt.Printf("color: %s\n", format(black, "black"))
fmt.Printf("color: %s\n", format(blue, "blue"))
fmt.Printf("color: %s\n", format(fuchsia, "fuchsia"))
fmt.Printf("color: %s\n", format(gray, "gray"))
fmt.Printf("color: %s\n", format(green, "green"))
fmt.Printf("color: %s\n", format(lime, "lime"))
fmt.Printf("color: %s\n", format(maroon, "maroon"))
fmt.Printf("color: %s\n", format(navy, "navy"))
fmt.Printf("color: %s\n", format(olive, "olive"))
fmt.Printf("color: %s\n", format(purple, "purple"))
fmt.Printf("color: %s\n", format(red, "red"))
fmt.Printf("color: %s\n", format(silver, "silver"))
fmt.Printf("color: %s\n", format(teal, "teal"))
fmt.Printf("color: %s\n", format(white, "white \033[1mwhite\033[0m"))
fmt.Printf("color: %s\n", format(yellow, "yellow "+bold("yellow")))

fmt.Printf("color: %s", format(teal, "kek "+bold("kek")))

}

0 comments on commit 1b0d015

Please sign in to comment.