textutil.go
func StringToColor(str string) term.Attribute {
	var parts []string
	if strings.ContainsRune(str, '+') {
		parts = strings.Split(str, "+")
	} else if strings.ContainsRune(str, '|') {
		parts = strings.Split(str, "|")
	} else if strings.ContainsRune(str, ' ') {
		parts = strings.Split(str, " ")
	} else {
		parts = append(parts, str)
	}

	var clr term.Attribute
	for _, item := range parts {
		item = strings.Trim(item, " ")
		item = strings.ToLower(item)

		c, ok := colorMap[item]
		if ok {
			clr |= c
		}
	}

	return clr
}
func StringToColor(str string) term.Attribute {
	var parts []string
	if strings.ContainsRune(str, '+') {
		parts = strings.Split(str, "+")
	} else if strings.ContainsRune(str, '|') {
		parts = strings.Split(str, "|")
	} else if strings.ContainsRune(str, ' ') {
		parts = strings.Split(str, " ")
	} else {
		parts = append(parts, str)
	}

	var clr term.Attribute
	for _, item := range parts {
		item = strings.Trim(item, " ")
		item = strings.ToLower(item)

		c, ok := colorMap[item]
		if ok {
			clr |= c
		}
	}

	return clr
}
func StringToColor ( str string ) term . Attribute { var parts [ ] string if strings . ContainsRune ( str , '+' ) { parts = strings . Split ( str , " " ) } else if strings . ContainsRune ( str , '|' ) { parts = strings . Split ( str , " " ) } else if strings . ContainsRune ( str , ' ' ) { parts = strings . Split ( str , " " ) } else { parts = append ( parts , str ) } var clr term . Attribute for _ , item := range parts { item = strings . Trim ( item , " " ) item = strings . ToLower ( item ) c , ok := colorMap [ item ] if ok { clr |= c } } return clr }
// StringToColor returns attribute by its string description.
// Description is the list of attributes separated with
// spaces, plus or pipe symbols. You can use 8 base colors:
// black, white, red, green, blue, magenta, yellow, cyan
// and a few modifiers:
// bold or bright, underline or underlined, reverse
// Note: some terminals do not support all modifiers, e.g,
// Windows one understands only bold/bright - it makes the
// color brighter with the modidierA
// Examples: "red bold", "green+underline+bold"
StringToColor returns attribute by its string description . Description is the list of attributes separated with spaces plus or pipe symbols . You can use 8 base colors : black white red green blue magenta yellow cyan and a few modifiers : bold or bright underline or underlined reverse Note : some terminals do not support all modifiers e . g Windows one understands only bold / bright - it makes the color brighter with the modidierA Examples : red bold green + underline + bold