Documentation
¶
Index ¶
- type CategoryStyling
- 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 StyledCategory
- type Stylesheet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CategoryStyling ¶
type CategoryStyling struct {
// contains filtered or unexported fields
}
CategoryStyling is a set of styled categories.
func EmptyCategoryStyling ¶
func EmptyCategoryStyling() *CategoryStyling
EmptyCategoryStyling returns an empty category styling.
func (*CategoryStyling) Add ¶
func (cs *CategoryStyling) Add(cat model.Category, style DrawStyling)
Add adds the given styling for the given category to this CategoryStyling.
func (*CategoryStyling) GetAll ¶
func (cs *CategoryStyling) GetAll() []StyledCategory
GetAll returns all styled categories in this styling.
func (*CategoryStyling) GetKnownCategoriesByName ¶
func (cs *CategoryStyling) GetKnownCategoriesByName() map[string]*model.Category
GetKnownCategoriesByName returns a mapping of category names to the fully parameterized categories (i.E. including priority), provided they exist. Allows ensuring that category data stays consistent across the program.
func (*CategoryStyling) GetStyle ¶
func (cs *CategoryStyling) GetStyle(c model.Category) (DrawStyling, error)
GetStyle returns the styling for the requested category from this styling.
If no styling is present for the category, it returns nil an an error.
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
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 StyleFromColors ¶
func StyleFromColors(fg, bg colorful.Color) *FallbackStyling
StyleFromColors constructs a style by the given colors.
func StyleFromHexPair ¶
func StyleFromHexPair(fg, bg string) *FallbackStyling
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
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 StyledCategory ¶
type StyledCategory struct { Style DrawStyling Cat model.Category }
StyledCategory is a category associated with a styling by which it should be rendered.
type Stylesheet ¶
type Stylesheet struct { 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 config.Stylesheet) *Stylesheet
NewStylesheetFromConfig constructs a new stylesheet from a given config stylesheet.