Open hcbb199 opened 1 year ago
If you press Ctrl+C when waiting for user input during interaction, the color of the output characters in cmd.exe is incorrect.
package main import ( "bufio" "github.com/fatih/color" "os" "strings" ) var ( Info = color.New(color.Bold, color.FgHiGreen) Error = color.New(color.Bold, color.FgHiRed) ) func main() { Info.Println("input your color: ") reader := bufio.NewReader(os.Stdin) input, _, err := reader.ReadLine() if err != nil { Error.Println(err.Error()) return } Info.Println("your input is " + strings.TrimSpace(string(input))) }
If you press Ctrl+C when waiting for user input during interaction, the color of the output characters in cmd.exe is incorrect.