From c738fa9eac5fcf7e0606d735248e172225c2b7d3 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Thu, 23 Aug 2018 11:28:01 -0700 Subject: [PATCH] Add hashtag colouring to Twitter widget --- twitter/widget.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/twitter/widget.go b/twitter/widget.go index d878cca2..8b744900 100644 --- a/twitter/widget.go +++ b/twitter/widget.go @@ -80,6 +80,10 @@ func (widget *Widget) highlightText(text string) string { linkRegExp := regexp.MustCompile(`http[s:\/.0-9A-Za-z]*`) 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 }