如何为没有第三方pkg的文本设置颜色

I want some text to be colored red and green. if the value < 0 then the color will be red and if the value > 0 then color will be green:

if x < 0 {
    fmt.Println("This line will be Red")
} else {
    fmt.Println("This line will be Green")
}

I want to know how to do that with the standard library not with third party pkg. How I can do that?

You can use:

if x < 0 {
    fmt.Println("\x1b[31;1m This line will be Red \x1b[0m")
} else {
    fmt.Println("\x1b[32;1m This line will be Green \x1b[0m")
}

You can play with the first number to change the color: [31,32,33...] and you always end with \x1b[0m.