-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9d251d
commit cbeaefc
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package fmt | ||
|
||
import "github.com/Cyberpull/gokit/color" | ||
|
||
var ( | ||
Green xColorFmt | ||
Red xColorFmt | ||
Cyan xColorFmt | ||
Magenta xColorFmt | ||
Black xColorFmt | ||
Blue xColorFmt | ||
White xColorFmt | ||
Yellow xColorFmt | ||
|
||
HiBlack xColorFmt | ||
HiBlue xColorFmt | ||
HiCyan xColorFmt | ||
HiGreen xColorFmt | ||
HiMagenta xColorFmt | ||
HiRed xColorFmt | ||
HiWhite xColorFmt | ||
HiYellow xColorFmt | ||
|
||
BgGreen xColorFmt | ||
BgRed xColorFmt | ||
BgCyan xColorFmt | ||
BgMagenta xColorFmt | ||
BgBlack xColorFmt | ||
BgBlue xColorFmt | ||
BgWhite xColorFmt | ||
BgYellow xColorFmt | ||
|
||
BgHiBlack xColorFmt | ||
BgHiBlue xColorFmt | ||
BgHiCyan xColorFmt | ||
BgHiGreen xColorFmt | ||
BgHiMagenta xColorFmt | ||
BgHiRed xColorFmt | ||
BgHiWhite xColorFmt | ||
BgHiYellow xColorFmt | ||
) | ||
|
||
func init() { | ||
Green.color = *color.New(color.FgGreen) | ||
Red.color = *color.New(color.FgRed) | ||
Cyan.color = *color.New(color.FgCyan) | ||
Magenta.color = *color.New(color.FgMagenta) | ||
Black.color = *color.New(color.FgBlack) | ||
Blue.color = *color.New(color.FgBlue) | ||
White.color = *color.New(color.FgWhite) | ||
Yellow.color = *color.New(color.FgYellow) | ||
|
||
HiBlack.color = *color.New(color.FgHiBlack) | ||
HiBlue.color = *color.New(color.FgHiBlue) | ||
HiCyan.color = *color.New(color.FgHiCyan) | ||
HiGreen.color = *color.New(color.FgHiGreen) | ||
HiMagenta.color = *color.New(color.FgHiMagenta) | ||
HiRed.color = *color.New(color.FgHiRed) | ||
HiWhite.color = *color.New(color.FgHiWhite) | ||
HiYellow.color = *color.New(color.FgHiYellow) | ||
|
||
// Background ====================== | ||
|
||
BgGreen.color = *color.New(color.BgGreen) | ||
BgRed.color = *color.New(color.BgRed) | ||
BgCyan.color = *color.New(color.BgCyan) | ||
BgMagenta.color = *color.New(color.BgMagenta) | ||
BgBlack.color = *color.New(color.BgBlack) | ||
BgBlue.color = *color.New(color.BgBlue) | ||
BgWhite.color = *color.New(color.BgWhite) | ||
BgYellow.color = *color.New(color.BgYellow) | ||
|
||
BgHiBlack.color = *color.New(color.BgHiBlack) | ||
BgHiBlue.color = *color.New(color.BgHiBlue) | ||
BgHiCyan.color = *color.New(color.BgHiCyan) | ||
BgHiGreen.color = *color.New(color.BgHiGreen) | ||
BgHiMagenta.color = *color.New(color.BgHiMagenta) | ||
BgHiRed.color = *color.New(color.BgHiRed) | ||
BgHiWhite.color = *color.New(color.BgHiWhite) | ||
BgHiYellow.color = *color.New(color.BgHiYellow) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Cyberpull/gokit/color" | ||
"github.com/Cyberpull/gokit/fmt" | ||
"github.com/stretchr/testify/require" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type FmtTestSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func (x *FmtTestSuite) TestColor() { | ||
require.NotPanics(x.T(), func() { | ||
logger := fmt.Color(color.BgCyan) | ||
logger.Println("Testing") | ||
}) | ||
} | ||
|
||
func (x *FmtTestSuite) TestRedColor() { | ||
require.NotPanics(x.T(), func() { | ||
fmt.Red.Println("Testing") | ||
}) | ||
} | ||
|
||
// =============================== | ||
|
||
func TestFmt(t *testing.T) { | ||
suite.Run(t, new(FmtTestSuite)) | ||
} |