-
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
d048927
committed
Dec 20, 2023
1 parent
3c2feb1
commit db3bca6
Showing
3 changed files
with
68 additions
and
1 deletion.
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 @@ | ||
.idea/ |
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,2 +1,17 @@ | ||
# color | ||
Go package containing color constants for ANSI terminals | ||
Go package containing color constants for ANSI terminals. | ||
|
||
# Intention | ||
The idea is to provide constants that can be used for simple color commands. Colors are simple | ||
string constants that can be included in printf commands, such as: | ||
```go | ||
fmt.Printf("Normal text – %sthis is green%s this is bold and green%s and this is regular again.\n", | ||
color.Green, color.Bold, color.Reset) | ||
``` | ||
You can also combine instructions such as: | ||
```go | ||
const ErrorColor = color.Red + color.Bold | ||
fmt.Printf("%sThis is wrong\n%s", ErrorColor, color.Reset) | ||
``` | ||
There is intentionally no code such as functions to print something in a specific color. If you are looking for | ||
something like that, look into [fatih/color](https://github.com/fatih/color). |
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,51 @@ | ||
package color | ||
|
||
const ( | ||
Reset = "\033[0m" | ||
|
||
Black = "\033[30m" | ||
Red = "\033[31m" | ||
Green = "\033[32m" | ||
Yellow = "\033[33m" | ||
Blue = "\033[34m" | ||
Magenta = "\033[35m" | ||
Cyan = "\033[36m" | ||
White = "\033[37m" | ||
|
||
HiBlack = "\033[90m" | ||
HiRed = "\033[91m" | ||
HiGreen = "\033[92m" | ||
HiYellow = "\033[93m" | ||
HiBlue = "\033[94m" | ||
HiMagenta = "\033[95m" | ||
HiCyan = "\033[96m" | ||
HiWhite = "\033[97m" | ||
|
||
Bold = "\033[1m" | ||
Faint = "\033[2m" | ||
Italic = "\033[3m" | ||
Underline = "\033[4m" | ||
BlinkSlow = "\033[5m" | ||
BlinkRapid = "\033[6m" | ||
ReverseVideo = "\033[7m" | ||
Concealed = "\033[8m" | ||
CrossedOut = "\033[9m" | ||
|
||
BgBlack = "\033[40m" | ||
BgRed = "\033[41m" | ||
BgGreen = "\033[42m" | ||
BgYellow = "\033[43m" | ||
BgBlue = "\033[44m" | ||
BgMagenta = "\033[45m" | ||
BgCyan = "\033[46m" | ||
BgWhite = "\033[47m" | ||
|
||
BgHiBlack = "\033[100m" | ||
BgHiRed = "\033[101m" | ||
BgHiGreen = "\033[102m" | ||
BgHiYellow = "\033[103m" | ||
BgHiBlue = "\033[104m" | ||
BgHiMagenta = "\033[105m" | ||
BgHiCyan = "\033[106m" | ||
BgHiWhite = "\033[107m" | ||
) |