Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): links + minor grammar fixes #409

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions color.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
if h, err := colorful.Hex(c); err == nil {
return h
} else if i, err := strconv.Atoi(c); err == nil {
if i < 16 { //nolint:gomnd

Check failure on line 69 in color.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 16, in <condition> detected (mnd)

Check failure on line 69 in color.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 16, in <condition> detected (mnd)

Check failure on line 69 in color.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 16, in <condition> detected (mnd)
return ansi.BasicColor(i) //nolint:gosec
} else if i < 256 { //nolint:gomnd
return ansi.ExtendedColor(i) //nolint:gosec
Expand Down Expand Up @@ -134,13 +134,14 @@
// In practice, there are slightly different workflows between Bubble Tea and
// Lip Gloss standalone.
//
// In Bubble Tea listen for tea.BackgroundColorMsg, which automatically
// flows through Update on start, and whenever the background color changes:
// In Bubble Tea, listen for tea.BackgroundColorMsg, which automatically
// flows through Update on start. This message will be received whenever the
// background color changes:
//
// case tea.BackgroundColorMsg:
// m.hasDarkBackground = msg.IsDark()
//
// Later, when you're rendering:
// Later, when you're rendering use:
//
// lightDark := lipgloss.LightDark(m.hasDarkBackground)
// myHotColor := lightDark("#ff0000", "#0000ff")
Expand Down
10 changes: 5 additions & 5 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ func BackgroundColor(in *os.File, out *os.File) (color.Color, error) {
// Typically, you'll want to query against stdin and either stdout or stderr
// depending on what you're writing to.
//
// hasDarkBG, _ := HasDarkBackground(os.Stdin, os.Stdout)
// adaptive := Adapt(hasDarkBG)
// myHotColor := Color("#ff0000", "#0000ff")
// hasDarkBG, _ := lipgloss.HasDarkBackground(os.Stdin, os.Stdout)
// lightDark := lipgloss.LightDark(hasDarkBG)
// myHotColor := lightDark("#ff0000", "#0000ff")
//
// This is intedded for use in standalone Lip Gloss only. In Bubble Tea, listen
// for tea.BackgroundColorMsg in your update function.
// This is intended for use in standalone Lip Gloss only. In Bubble Tea, listen
// for tea.BackgroundColorMsg in your Update function.
//
// case tea.BackgroundColorMsg:
// hasDarkBackground = msg.IsDark()
Expand Down
2 changes: 1 addition & 1 deletion set.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@

// Underline sets an underline rule. By default, underlines will not be drawn on
// whitespace like margins and padding. To change this behavior set
// UnderlineSpaces.
// [Style.UnderlineSpaces].
func (s Style) Underline(v bool) Style {
s.set(underlineKey, v)
return s
Expand Down Expand Up @@ -705,19 +705,19 @@
left = i[0]
right = i[0]
ok = true
case 2: //nolint:gomnd

Check failure on line 708 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 2, in <case> detected (mnd)

Check failure on line 708 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 2, in <case> detected (mnd)

Check failure on line 708 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 2, in <case> detected (mnd)
top = i[0]
bottom = i[0]
left = i[1]
right = i[1]
ok = true
case 3: //nolint:gomnd

Check failure on line 714 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 3, in <case> detected (mnd)

Check failure on line 714 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 3, in <case> detected (mnd)

Check failure on line 714 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 3, in <case> detected (mnd)
top = i[0]
left = i[1]
right = i[1]
bottom = i[2]
ok = true
case 4: //nolint:gomnd

Check failure on line 720 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 4, in <case> detected (mnd)

Check failure on line 720 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 4, in <case> detected (mnd)

Check failure on line 720 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 4, in <case> detected (mnd)
top = i[0]
right = i[1]
bottom = i[2]
Expand All @@ -738,19 +738,19 @@
left = i[0]
right = i[0]
ok = true
case 2: //nolint:gomnd

Check failure on line 741 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 2, in <case> detected (mnd)

Check failure on line 741 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 2, in <case> detected (mnd)

Check failure on line 741 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 2, in <case> detected (mnd)
top = i[0]
bottom = i[0]
left = i[1]
right = i[1]
ok = true
case 3: //nolint:gomnd

Check failure on line 747 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 3, in <case> detected (mnd)

Check failure on line 747 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 3, in <case> detected (mnd)

Check failure on line 747 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 3, in <case> detected (mnd)
top = i[0]
left = i[1]
right = i[1]
bottom = i[2]
ok = true
case 4: //nolint:gomnd

Check failure on line 753 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 4, in <case> detected (mnd)

Check failure on line 753 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 4, in <case> detected (mnd)

Check failure on line 753 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 4, in <case> detected (mnd)
top = i[0]
right = i[1]
bottom = i[2]
Expand All @@ -771,19 +771,19 @@
left = i[0]
right = i[0]
ok = true
case 2: //nolint:gomnd

Check failure on line 774 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 2, in <case> detected (mnd)

Check failure on line 774 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 2, in <case> detected (mnd)

Check failure on line 774 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 2, in <case> detected (mnd)
top = i[0]
bottom = i[0]
left = i[1]
right = i[1]
ok = true
case 3: //nolint:gomnd

Check failure on line 780 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 3, in <case> detected (mnd)

Check failure on line 780 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 3, in <case> detected (mnd)

Check failure on line 780 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 3, in <case> detected (mnd)
top = i[0]
left = i[1]
right = i[1]
bottom = i[2]
ok = true
case 4: //nolint:gomnd

Check failure on line 786 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (ubuntu-latest)

Magic number: 4, in <case> detected (mnd)

Check failure on line 786 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (macos-latest)

Magic number: 4, in <case> detected (mnd)

Check failure on line 786 in set.go

View workflow job for this annotation

GitHub Actions / lint / lint-soft (windows-latest)

Magic number: 4, in <case> detected (mnd)
top = i[0]
right = i[1]
bottom = i[2]
Expand Down
7 changes: 3 additions & 4 deletions size.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// ignored and characters wider than one cell (such as Chinese characters and
// emojis) are appropriately measured.
//
// You should use this instead of len(string) len([]rune(string) as neither
// You should use this instead of len(string) or len([]rune(string) as neither
// will give you accurate results.
func Width(str string) (width int) {
for _, l := range strings.Split(str, "\n") {
Expand All @@ -24,9 +24,8 @@ func Width(str string) (width int) {
}

// Height returns height of a string in cells. This is done simply by
// counting \n characters. If your strings use \r\n for newlines you should
// convert them to \n first, or simply write a separate function for measuring
// height.
// counting \n characters. If your output has \r\n, that sequence will be
// replaced with a \n in [Style.Render].
func Height(str string) int {
return strings.Count(str, "\n") + 1
}
Expand Down
6 changes: 3 additions & 3 deletions style.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (p props) has(k propKey) bool {
}

// NewStyle returns a new, empty Style. While it's syntactic sugar for the
// Style{} primitive, it's recommended to use this function for creating styles
// [Style]{} primitive, it's recommended to use this function for creating styles
// in case the underlying implementation changes.
func NewStyle() Style {
return Style{}
Expand Down Expand Up @@ -155,10 +155,10 @@ func joinString(strs ...string) string {
}

// SetString sets the underlying string value for this style. To render once
// the underlying string is set, use the Style.String. This method is
// the underlying string is set, use the [Style.String]. This method is
// a convenience for cases when having a stringer implementation is handy, such
// as when using fmt.Sprintf. You can also simply define a style and render out
// strings directly with Style.Render.
// strings directly with [Style.Render].
func (s Style) SetString(strs ...string) Style {
s.value = joinString(strs...)
return s
Expand Down
Loading