Documentation
¶
Index ¶
- func ColorfulColorFromHexString(hex string) (colorful.Color, error)
- type DrawStyling
- type FallbackStyling
- func (s *FallbackStyling) AsTcell() tcell.Style
- func (s *FallbackStyling) Bolded() DrawStyling
- func (s *FallbackStyling) DarkenedBG(percentage int) DrawStyling
- func (s *FallbackStyling) DarkenedFG(percentage int) DrawStyling
- func (s *FallbackStyling) DefaultDimmed() DrawStyling
- func (s *FallbackStyling) DefaultEmphasized() DrawStyling
- func (s *FallbackStyling) Invert() DrawStyling
- func (s *FallbackStyling) Italicized() DrawStyling
- func (s *FallbackStyling) LightenedBG(percentage int) DrawStyling
- func (s *FallbackStyling) LightenedFG(percentage int) DrawStyling
- func (s *FallbackStyling) NormalizeFromBG(luminanceOffset float64) DrawStyling
- func (s *FallbackStyling) ToString() string
- func (s *FallbackStyling) Unbolded() DrawStyling
- func (s *FallbackStyling) Unitalicized() DrawStyling
- type Stylesheet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DrawStyling ¶
type DrawStyling interface {
AsTcell() tcell.Style
DefaultDimmed() DrawStyling
DefaultEmphasized() DrawStyling
NormalizeFromBG(luminanceOffset float64) DrawStyling
Invert() DrawStyling
LightenedFG(percentage int) DrawStyling
LightenedBG(percentage int) DrawStyling
DarkenedFG(percentage int) DrawStyling
DarkenedBG(percentage int) DrawStyling
Italicized() DrawStyling
Unitalicized() DrawStyling
Bolded() DrawStyling
Unbolded() DrawStyling
ToString() string
}
DrawStyling is style information used for rendering text. It should represent foreground and background color as well as modifiers such as italicization. A DrawStyling can be converted to any styling needed by a renderer, e.g., AsTcell tcell.Style for a tcell-based renderer via AsTcell.
func StyleFromConfig ¶
func StyleFromConfig(config config.Styling) (DrawStyling, error)
StyleFromConfig takes a styling as specified in a configuration file and converts it to a usable DrawStyling.
type FallbackStyling ¶
type FallbackStyling struct {
// contains filtered or unexported fields
}
FallbackStyling is a DrawStyling that holds non-renderer-specific colors.
func StyleFromColorSingle ¶ added in v0.10.0
func StyleFromColorSingle(accentColor colorful.Color, darkBG bool) (*FallbackStyling, error)
StyleFromColorSingle takes the given color as a background and returns a style in which the foreground is inferred from the background (same hue and saturation, different luminance).
func StyleFromColors ¶
func StyleFromColors(fg, bg colorful.Color) *FallbackStyling
StyleFromColors constructs a style by the given colors.
func StyleFromHexPair ¶
func StyleFromHexPair(fg, bg string) (*FallbackStyling, error)
StyleFromHexPair constructs and returns a styling from two hexadecimally formatted strings for the foreground and background color. Strings have to have hexadecimal or HTML color notation and lead with a '#'.
Examples:
- '#ff0000'
- '#fff'
- '#BEEF42'
func StyleFromHexSingle ¶
func StyleFromHexSingle(hexString string, darkBG bool) (*FallbackStyling, error)
StyleFromHexSingle takes the given hex color as a background and returns a style in which the foreground is inferred from the background (same hue and saturation, different luminance).
func (*FallbackStyling) AsTcell ¶
func (s *FallbackStyling) AsTcell() tcell.Style
AsTcell returns this styling as a tcell.Style.
func (*FallbackStyling) Bolded ¶
func (s *FallbackStyling) Bolded() DrawStyling
Bolded returns a copy of this styling which is guaranteed to be bolded. If the original styling was already bolded, this effectively returns an exact copy.
func (*FallbackStyling) DarkenedBG ¶
func (s *FallbackStyling) DarkenedBG(percentage int) DrawStyling
DarkenedBG returns a copy of this styling with the background color darkened by the requested percentage.
func (*FallbackStyling) DarkenedFG ¶
func (s *FallbackStyling) DarkenedFG(percentage int) DrawStyling
DarkenedFG returns a copy of this styling with the foreground color darkened by the requested percentage.
func (*FallbackStyling) DefaultDimmed ¶
func (s *FallbackStyling) DefaultDimmed() DrawStyling
DefaultDimmed returns a copy of this styling with 'dimmed' colors, i.E. it lightens them by a default value.
func (*FallbackStyling) DefaultEmphasized ¶
func (s *FallbackStyling) DefaultEmphasized() DrawStyling
DefaultEmphasized returns a copy of this styling with 'emphasized' colors, i.E. it darkens them by a default value.
func (*FallbackStyling) Invert ¶
func (s *FallbackStyling) Invert() DrawStyling
Invert returns an inversion of the style.
func (*FallbackStyling) Italicized ¶
func (s *FallbackStyling) Italicized() DrawStyling
Italicized returns a copy of this styling which is guaranteed to be italicized. If the original styling was already italicized, this effectively returns an exact copy.
func (*FallbackStyling) LightenedBG ¶
func (s *FallbackStyling) LightenedBG(percentage int) DrawStyling
LightenedBG returns a copy of this styling with the background color lightened by the requested percentage.
func (*FallbackStyling) LightenedFG ¶
func (s *FallbackStyling) LightenedFG(percentage int) DrawStyling
LightenedFG returns a copy of this styling with the foreground color lightened by the requested percentage.
func (*FallbackStyling) NormalizeFromBG ¶
func (s *FallbackStyling) NormalizeFromBG(luminanceOffset float64) DrawStyling
NormalizeFromBG returns a new style based off the background color where the foreground is set to an appropriate pairing color for the background.
func (*FallbackStyling) ToString ¶
func (s *FallbackStyling) ToString() string
ToString returns a string representation of this styling, e.g., for logging purposes.
func (*FallbackStyling) Unbolded ¶
func (s *FallbackStyling) Unbolded() DrawStyling
Unbolded returns a copy of this styling which is guaranteed to _not_ be bolded. If the original styling was already non-bolded, this effectively returns an exact copy.
func (*FallbackStyling) Unitalicized ¶
func (s *FallbackStyling) Unitalicized() DrawStyling
Unitalicized returns a copy of this styling which is guaranteed to _not_ be italicized. If the original styling was already not italicized, this effectively returns an exact copy.
type Stylesheet ¶
type Stylesheet struct {
Theme cfg.ColorschemeType
Normal DrawStyling
NormalEmphasized DrawStyling
WeatherNormal DrawStyling
WeatherSunny DrawStyling
WeatherRainy DrawStyling
TimelineDay DrawStyling
TimelineNight DrawStyling
TimelineNow DrawStyling
Status DrawStyling
CategoryFallback DrawStyling
LogDefault DrawStyling
LogTitleBox DrawStyling
LogEntryTypeError DrawStyling
LogEntryTypeWarn DrawStyling
LogEntryTypeInfo DrawStyling
LogEntryTypeDebug DrawStyling
LogEntryTypeTrace DrawStyling
LogEntryLocation DrawStyling
LogEntryTime DrawStyling
Help DrawStyling
Editor DrawStyling
SummaryDefault DrawStyling
SummaryTitleBox DrawStyling
}
Stylesheet represents all styles used by the application for rendering.
func NewStylesheetFromConfig ¶
func NewStylesheetFromConfig(config cfg.Stylesheet, theme cfg.ColorschemeType) (*Stylesheet, error)
NewStylesheetFromConfig constructs a new stylesheet from a given config stylesheet.
func (Stylesheet) Verify ¶ added in v0.10.0
func (s Stylesheet) Verify()