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"
|
|
|
|
)
|
|
|
|
|
2020-06-13 07:29:32 +00:00
|
|
|
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>`
|
|
|
|
}
|
|
|
|
|
2020-06-17 07:06:34 +00:00
|
|
|
// used for grabbing text without changing state
|
|
|
|
type nullLabel struct{ text.Rich }
|
2020-06-07 04:27:28 +00:00
|
|
|
|
2020-06-17 07:06:34 +00:00
|
|
|
func (n *nullLabel) SetLabel(t text.Rich) { n.Rich = t }
|
2020-06-04 23:00:41 +00:00
|
|
|
|
2020-06-17 07:06:34 +00:00
|
|
|
// used for grabbing url without changing state
|
|
|
|
type nullIcon struct{ url string }
|
2020-06-04 23:00:41 +00:00
|
|
|
|
2020-06-17 07:06:34 +00:00
|
|
|
func (i *nullIcon) SetIcon(url string) { i.url = url }
|