Added helper functions in package text

This package adds back the Plain function from the old package text as
well as a new function called SolidColor that returns a new RGBA color
with the alpha bits maxed out.

These functions are there for convenience. They're also outside the
scope of the code generator and repository.
This commit is contained in:
diamondburned 2020-10-03 21:29:15 -07:00
parent 7b9b4864a5
commit e2751cc260
1 changed files with 12 additions and 0 deletions

12
text/text_extras.go Normal file
View File

@ -0,0 +1,12 @@
package text
// Plain creates a new text.Rich without any formatting segments.
func Plain(text string) Rich {
return Rich{Content: text}
}
// SolidColor takes in a 24-bit RGB color and overrides the alpha bits with
// 0xFF, making the color solid.
func SolidColor(rgb uint32) uint32 {
return rgb | (0xFF << 24)
}