mirror of
https://github.com/diamondburned/cchat-discord.git
synced 2024-11-27 00:22:55 +00:00
26 lines
415 B
Go
26 lines
415 B
Go
|
package segments
|
||
|
|
||
|
import "github.com/diamondburned/cchat/text"
|
||
|
|
||
|
type Colored struct {
|
||
|
strlen int
|
||
|
color uint32
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
_ text.Colorer = (*Colored)(nil)
|
||
|
_ text.Segment = (*Colored)(nil)
|
||
|
)
|
||
|
|
||
|
func NewColored(strlen int, color uint32) Colored {
|
||
|
return Colored{strlen, color}
|
||
|
}
|
||
|
|
||
|
func (color Colored) Bounds() (start, end int) {
|
||
|
return 0, color.strlen
|
||
|
}
|
||
|
|
||
|
func (color Colored) Color() uint32 {
|
||
|
return color.color
|
||
|
}
|