about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/printer.go26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/printer.go b/src/printer.go
index 5720897..f36dd99 100644
--- a/src/printer.go
+++ b/src/printer.go
@@ -89,30 +89,34 @@ func printResponses(channels channels) {
 			}
 		}
 
-		// color to display the status code in (either green or red)
-		var color string
+		// localColor to display the status code in (either green or red)
+		var localColor string
 
-		// set the prefix, postfix and color according to the hidden state
+		// set the prefix, postfix and localColor according to the hidden state
 		if hidden == true {
 			prefix = ""
 			postfix = "\033[K\r"
-			color = "red"
+			localColor = "red"
 		} else {
 			prefix = "\r\033[K"
 			postfix = "\n"
-			color = "green"
+			localColor = "green"
 		}
 
 		// statusCode string (with ansi escape codes)
 		var statusCode string
 
-		// color
-		if color == "red" {
-			statusCode = red(fmt.Sprintf("%d", response.StatusCode))
-		} else if color == "green" {
-			statusCode = green(fmt.Sprintf("%d", response.StatusCode))
+		// localColor
+		if color == true {
+			if localColor == "red" {
+				statusCode = red(fmt.Sprintf("%d", response.StatusCode))
+			} else if localColor == "green" {
+				statusCode = green(fmt.Sprintf("%d", response.StatusCode))
+			} else {
+				statusCode = cyan(fmt.Sprintf("%d", response.StatusCode))
+			}
 		} else {
-			statusCode = cyan(fmt.Sprintf("%d", response.StatusCode))
+			statusCode = fmt.Sprintf("%d", response.StatusCode)
 		}
 
 		// print the requests