1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-gtk.git synced 2024-11-15 18:52:45 +00:00
cchat-gtk/internal/ui/rich/rich.go

23 lines
441 B
Go
Raw Normal View History

2020-06-04 23:00:41 +00:00
package rich
import (
2020-06-07 04:27:28 +00:00
"html"
2020-06-04 23:00:41 +00:00
"github.com/diamondburned/cchat/text"
)
func Small(text string) string {
return `<span size="small" color="#808080">` + text + "</span>"
}
2020-06-04 23:00:41 +00:00
2020-06-07 04:27:28 +00:00
func MakeRed(content text.Rich) string {
return `<span color="red">` + html.EscapeString(content.Content) + `</span>`
}
// used for grabbing text without changing state
2020-06-30 03:39:42 +00:00
type nullLabel struct {
text.Rich
}
2020-06-07 04:27:28 +00:00
func (n *nullLabel) SetLabel(t text.Rich) { n.Rich = t }