-
Notifications
You must be signed in to change notification settings - Fork 3
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
code-raisan
committed
May 18, 2022
1 parent
a111972
commit d097ce8
Showing
2 changed files
with
52 additions
and
3 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,11 @@ | ||
# gocolor | ||
|
||
Goでコンソールに出力する文字色を変えれます。 | ||
|
||
# How to use | ||
|
||
1. Install | ||
|
||
```bash | ||
go install | ||
``` |
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 |
---|---|---|
@@ -1,5 +1,43 @@ | ||
package gocolor | ||
package main | ||
|
||
func Say() { | ||
print("hello") | ||
var defalt string = "\u001b[0m" | ||
|
||
func Red(text string) string { | ||
result := "\u001b[31m" + text + defalt | ||
return result | ||
} | ||
|
||
func Blue(text string) string { | ||
result := "\u001b[34m" + text + defalt | ||
return result | ||
} | ||
|
||
func Yellow(text string) string { | ||
result := "\u001b[33m" + text + defalt | ||
return result | ||
} | ||
|
||
func Green(text string) string { | ||
result := "\u001b[32m" + text + defalt | ||
return result | ||
} | ||
|
||
func Magenta(text string) string { | ||
result := "\u001b[35m" + text + defalt | ||
return result | ||
} | ||
|
||
func Cayn(text string) string { | ||
result := "\u001b[36m" + text + defalt | ||
return result | ||
} | ||
|
||
func White(text string) string { | ||
result := "\u001b[37m" + text + defalt | ||
return result | ||
} | ||
|
||
func Black(text string) string { | ||
result := "\u001b[30m" + text + defalt | ||
return result | ||
} |