You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
730 B

4 years ago
package style
const (
Black Color = "0"
Red Color = "1"
Green Color = "2"
Yellow Color = "3"
Blue Color = "4"
Magenta Color = "5"
Cyan Color = "6"
White Color = "7"
Default Color = "9"
)
const (
Bold Option = "122"
Underscore Option = "424"
Blink Option = "525"
Reverse Option = "727"
Conseal Option = "828"
)
const (
ActionSet = 1
ActionUnset = 2
)
type Option string
func (o Option) Apply(action int) string {
out := string(o)
4 years ago
switch action {
case ActionSet:
return out[0:1]
4 years ago
case ActionUnset:
return out[1:]
4 years ago
}
return ""
}
type Color string
func (c Color) Apply(action int) string {
if action == ActionSet {
return string(c)
}
return string(Default)
}