Documentation
¶
Overview ¶
Text rendering shared by every card, markdown, code, diffs, tables and small formatters tuned to the theme
Index ¶
- Constants
- func Bad(text string, t theme.Theme) string
- func Bytes(n int64) string
- func CodeStyle(t theme.Theme) string
- func Columns(cols []Column, rows [][]string, width int) (xs, widths []int)
- func Cool(text string, t theme.Theme) string
- func Count(n int, noun string) string
- func Dim(text string, t theme.Theme) string
- func Divider(width int, t theme.Theme) string
- func Elapsed(d time.Duration) string
- func Fit(s string, width int, t theme.Theme) string
- func Good(text string, t theme.Theme) string
- func Heading(text string, t theme.Theme) string
- func Money(f float64) string
- func Paint(st lipgloss.Style, text string) string
- func Percent(f float64) string
- func Spinner(tick int, t theme.Theme) string
- func StyleConfig(t theme.Theme) ansi.StyleConfig
- func TableEdit(cols []Column, rows [][]string, width int, selected int, edit *Edit, ...) string
- func TableMarked(cols []Column, rows [][]string, width int, selected int, marked func(int) bool, ...) string
- func Tokens(n int) string
- func ToolGlyph(name string, t theme.Theme) string
- func Truncate(s string, width int, t theme.Theme) string
- func Warm(text string, t theme.Theme) string
- func Wrap(s string, width int) string
- type Column
- type Edit
- type Line
- type Markdown
- type Op
Constants ¶
const MaxDiffLines = 6000
Lines beyond which a diff is summarized instead of computed
const TableHead = 2
Rows the table spends above its first row, the header and the rule under it
Variables ¶
This section is empty.
Functions ¶
func Divider ¶
Dashed rule of width with the theme info mark at its middle, dashes alone when too narrow for one
func Paint ¶
Renders text in the style, restarting the style after every reset inside the text so its background runs unbroken
func StyleConfig ¶
func StyleConfig(t theme.Theme) ansi.StyleConfig
Glamour style derived from the theme, starting from the dark, light or ASCII set
func TableEdit ¶
func TableEdit(cols []Column, rows [][]string, width int, selected int, edit *Edit, t theme.Theme) string
Renders the table with one cell of the selected row shown as it is being typed into
func TableMarked ¶
func TableMarked(cols []Column, rows [][]string, width int, selected int, marked func(int) bool, edit *Edit, t theme.Theme) string
Renders the table with the cursor row lit and every other marked row tinted as part of the selection
Types ¶
type Column ¶
type Column struct {
Title string
// Share of spare width the column takes, zero fitting it to its content
Flex int
// Right aligns the cells, for numbers
Right bool
// Largest width the column grows to, unlimited when zero
Max int
}
Column of a table with how its cells align
type Edit ¶
Cell of the selected row being typed into in place, its text with the caret at a rune offset, shown selected until the first keystroke
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
Markdown renderer cached per theme and width
func NewMarkdown ¶
func NewMarkdown() *Markdown