diff --git a/doc.go b/doc.go index 1e114128..fef4575a 100644 --- a/doc.go +++ b/doc.go @@ -94,9 +94,9 @@ means "reset to default". You can specify the following flags (some flags may not be supported by your terminal): - l: blink b: bold d: dim + l: blink r: reverse (switch foreground and background color) u: underline diff --git a/util.go b/util.go index 440c7bea..61790a36 100644 --- a/util.go +++ b/util.go @@ -20,7 +20,7 @@ const ( // Common regular expressions. var ( - colorPattern = regexp.MustCompile(`\[([a-zA-Z]+|#[0-9a-zA-Z]{6}|\-)?(:([a-zA-Z]+|#[0-9a-zA-Z]{6}|\-)?(:([lbdru]+|\-)?)?)?\]`) + colorPattern = regexp.MustCompile(`\[([a-zA-Z]+|#[0-9a-zA-Z]{6}|\-)?(:([a-zA-Z]+|#[0-9a-zA-Z]{6}|\-)?(:([bdlru]+|\-)?)?)?\]`) regionPattern = regexp.MustCompile(`\["([a-zA-Z0-9_,;: \-\.]*)"\]`) escapePattern = regexp.MustCompile(`\[([a-zA-Z0-9_,;: \-\."#]+)\[(\[*)\]`) nonEscapePattern = regexp.MustCompile(`(\[[a-zA-Z0-9_,;: \-\."#]+\[*)\]`) @@ -125,20 +125,20 @@ func overlayStyle(style tcell.Style, fgColor, bgColor, attributes string) tcell. if attributes == "-" { style = style.Bold(defAttr&tcell.AttrBold > 0) + style = style.Dim(defAttr&tcell.AttrDim > 0) style = style.Blink(defAttr&tcell.AttrBlink > 0) style = style.Reverse(defAttr&tcell.AttrReverse > 0) style = style.Underline(defAttr&tcell.AttrUnderline > 0) - style = style.Dim(defAttr&tcell.AttrDim > 0) } else if attributes != "" { style = style.Normal() for _, flag := range attributes { switch flag { - case 'l': - style = style.Blink(true) case 'b': style = style.Bold(true) case 'd': style = style.Dim(true) + case 'l': + style = style.Blink(true) case 'r': style = style.Reverse(true) case 'u':