2024-03-05 16:47:02 +00:00
|
|
|
package color
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
// These constants represent the escape codes needed to display color in terminals.
|
|
|
|
const (
|
|
|
|
format = "\x1b[38;2;%d;%d;%dm%s\x1b[0m"
|
2024-03-05 18:10:27 +00:00
|
|
|
formatLine = "\x1b[38;2;%d;%d;%dm%s\n\x1b[0m"
|
2024-03-05 16:47:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Terminal is a boolean that indicates if we're in a terminal with truecolor support.
|
|
|
|
var Terminal = os.Getenv("COLORTERM") == "truecolor"
|