1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 15:10:54 +00:00

Merge pull request #326 from amrfaissal/more-colors

Adds more colors to color.go
This commit is contained in:
Faissal Elamraoui 2016-11-23 16:00:53 +01:00 committed by GitHub
commit a6ce37ddf3
2 changed files with 21 additions and 1 deletions

View File

@ -57,6 +57,16 @@ func bold(message string) string {
return fmt.Sprintf("\x1b[1m%s\x1b[21m", message) return fmt.Sprintf("\x1b[1m%s\x1b[21m", message)
} }
// Black returns a black string
func Black(message string) string {
return fmt.Sprintf("\x1b[30m%s\x1b[0m", message)
}
// White returns a white string
func White(message string) string {
return fmt.Sprintf("\x1b[37m%s\x1b[0m", message)
}
// Cyan returns a cyan string // Cyan returns a cyan string
func Cyan(message string) string { func Cyan(message string) string {
return fmt.Sprintf("\x1b[36m%s\x1b[0m", message) return fmt.Sprintf("\x1b[36m%s\x1b[0m", message)
@ -92,6 +102,16 @@ func Magenta(message string) string {
return fmt.Sprintf("\x1b[35m%s\x1b[0m", message) return fmt.Sprintf("\x1b[35m%s\x1b[0m", message)
} }
// BlackBold returns a black bold string
func BlackBold(message string) string {
return fmt.Sprintf("\x1b[30m%s\x1b[0m", bold(message))
}
// WhiteBold returns a white bold string
func WhiteBold(message string) string {
return fmt.Sprintf("\x1b[37m%s\x1b[0m", bold(message))
}
// CyanBold returns a cyan bold string // CyanBold returns a cyan bold string
func CyanBold(message string) string { func CyanBold(message string) string {
return fmt.Sprintf("\x1b[36m%s\x1b[0m", bold(message)) return fmt.Sprintf("\x1b[36m%s\x1b[0m", bold(message))

View File

@ -96,7 +96,7 @@ func NewWatcher(paths []string, files []string, isgenerate bool) {
} }
// getFileModTime retuens unix timestamp of `os.File.ModTime` by given path. // getFileModTime returns unix timestamp of `os.File.ModTime` for the given path.
func getFileModTime(path string) int64 { func getFileModTime(path string) int64 {
path = strings.Replace(path, "\\", "/", -1) path = strings.Replace(path, "\\", "/", -1)
f, err := os.Open(path) f, err := os.Open(path)