1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add hashtag colouring to Twitter widget

This commit is contained in:
Chris Cummer 2018-08-23 11:28:01 -07:00
parent 2af837d5cf
commit c738fa9eac

View File

@ -80,6 +80,10 @@ func (widget *Widget) highlightText(text string) string {
linkRegExp := regexp.MustCompile(`http[s:\/.0-9A-Za-z]*`) linkRegExp := regexp.MustCompile(`http[s:\/.0-9A-Za-z]*`)
result = linkRegExp.ReplaceAllString(result, "[lightblue::u]${0}[white::-]") result = linkRegExp.ReplaceAllString(result, "[lightblue::u]${0}[white::-]")
// Hash tags
hashRegExp := regexp.MustCompile(`#[0-9A-Za-z_]*`)
result = hashRegExp.ReplaceAllString(result, "[yellow]${0}[white]")
return result return result
} }