1234567891011121314151617181920212223242526272829303132333435363738 |
- package aes
- import "fmt"
- // The type implements more or less
- type EffectText struct {
- Effects Effects
- Text string
- }
- func (et EffectText) String() string {
- return fmt.Sprintf(
- CSI+"%sm%s"+CSI+"0m",
- et.Effects.Format(), et.Text,
- )
- }
- // Create new EffectText with formatted
- // by the fmt.Sprintf string as text data.
- func ETF(format string, v ...any) EffectText {
- ret := EffectText{}
- ret.Text = fmt.Sprintf(format, v...)
- return ret
- }
- // Returns the new EffectText with specified
- // effects appended.
- func (et EffectText) With(effects ...Effect) EffectText {
- et.Effects = append(et.Effects, effects...)
- return et
- }
- // Add the bold effect and return
- // the resulting EffectText.
- func (et EffectText) Bold() EffectText {
- return et.With(EffectBold)
- }
|