MCPcopy Create free account
hub / github.com/basecamp/hey-cli / wrapText

Function wrapText

internal/tui/styles.go:79–100  ·  view source on GitHub ↗

wrapText wraps a string to fit within maxWidth characters.

(s string, maxWidth int)

Source from the content-addressed store, hash-verified

77 // better there.
78 colorOnAccent = lipgloss.Black
79 if nc, ok := theme.Accent.(lipgloss.NoColor); ok {
80 colorLink = nc
81 colorOnAccent = nc
82 } else if theme.Accent != color.Color(lipgloss.BrightBlue) &&
83 contrastRatio(lipgloss.BrightWhite, theme.Accent) > contrastRatio(lipgloss.Black, theme.Accent) {
84 colorOnAccent = lipgloss.BrightWhite
85 }
86 colorHues = theme.Hues
87 colorPaper = theme.Background
88 if colorPaper == nil {
89 colorPaper = lipgloss.Black
90 if !theme.Dark {
91 colorPaper = lipgloss.BrightWhite
92 }
93 }
94 if !theme.Dark && theme.Bright == lipgloss.BrightWhite {
95 // Bright white is the background on a light terminal; ANSI black is its text.
96 colorBright = lipgloss.Black
97 }
98}
99
100// selectionStyle returns a style that paints the selection background when the
101// theme has one, and the style unchanged otherwise. Every segment of a cursor row
102// goes through it so the row reads as one highlighted line.
103func selectionStyle(s lipgloss.Style) lipgloss.Style {

Callers 1

errorViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected