Add support for ANSI color codes

This commit is contained in:
Junegunn Choi
2015-03-19 01:59:14 +09:00
parent d80a41bb6d
commit e70a2a5817
11 changed files with 451 additions and 24 deletions

View File

@@ -27,6 +27,17 @@ func Max32(first int32, second int32) int32 {
return second
}
// Constrain32 limits the given 32-bit integer with the upper and lower bounds
func Constrain32(val int32, min int32, max int32) int32 {
if val < min {
return min
}
if val > max {
return max
}
return val
}
// Constrain limits the given integer with the upper and lower bounds
func Constrain(val int, min int, max int) int {
if val < min {