charmbracelet/lipgloss (github.com/charmbracelet/lipgloss)
### [`v0.13.0`](https://togithub.com/charmbracelet/lipgloss/releases/tag/v0.13.0)
[Compare Source](https://togithub.com/charmbracelet/lipgloss/compare/v0.12.1...v0.13.0)
### Woodn’t you know, Lip Gloss has trees!
Lip Gloss ships with a tree rendering sub-package.
```go
import "github.com/charmbracelet/lipgloss/tree"
```
Define a new tree.
```go
t := tree.Root(".").
Child("A", "B", "C")
```
Print the tree.
```go
fmt.Println(t)
// .
// ├── A
// ├── B
// └── C
```
Trees have the ability to nest.
```go
t := tree.Root(".").
Child("macOS").
Child(
tree.New().
Root("Linux").
Child("NixOS").
Child("Arch Linux (btw)").
Child("Void Linux"),
).
Child(
tree.New().
Root("BSD").
Child("FreeBSD").
Child("OpenBSD"),
)
```
Print the tree.
```go
fmt.Println(t)
```
Trees can be customized via their enumeration function as well as using
`lipgloss.Style`s.
```go
enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("63")).MarginRight(1)
rootStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("35"))
itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("212"))
t := tree.
Root("⁜ Makeup").
Child(
"Glossier",
"Fenty Beauty",
tree.New().Child(
"Gloss Bomb Universal Lip Luminizer",
"Hot Cheeks Velour Blushlighter",
),
"Nyx",
"Mac",
"Milk",
).
Enumerator(tree.RoundedEnumerator).
EnumeratorStyle(enumeratorStyle).
RootStyle(rootStyle).
ItemStyle(itemStyle)
```
Print the tree.
The predefined enumerators for trees are `DefaultEnumerator` and `RoundedEnumerator`.
If you need, you can also build trees incrementally:
```go
t := tree.New()
for i := 0; i < repeat; i++ {
t.Child("Lip Gloss")
}
```
#### There’s more where that came from
See [all the tree examples](https://togithub.com/charmbracelet/lipgloss/tree/master/examples/tree).
***
#### Changelog
##### New Features
- [`0618c73`](https://togithub.com/charmbracelet/lipgloss/commit/0618c73743d90bb724af8f5a75e4c17bced1ff87): feat(test): add test for `JoinHorizontal` ([#346](https://togithub.com/charmbracelet/lipgloss/issues/346)) ([@aditipatelpro](https://togithub.com/aditipatelpro))
- [`feb42a9`](https://togithub.com/charmbracelet/lipgloss/commit/feb42a9be4a0577fd10b8e9ba80541ca759fb60c): feat: move tree to root ([#342](https://togithub.com/charmbracelet/lipgloss/issues/342)) ([@caarlos0](https://togithub.com/caarlos0))
##### Bug fixes
- [`8a0e640`](https://togithub.com/charmbracelet/lipgloss/commit/8a0e6405b71da72f705fbdb6a98eba0095ddbabe): fix: remove unnecessary if ([@aymanbagabas](https://togithub.com/aymanbagabas))
##### Documentation updates
- [`bc0de5c`](https://togithub.com/charmbracelet/lipgloss/commit/bc0de5ca26463c5d6f6f8abcb28a5d3090019fd8): docs(README): make tree example match output ([@bashbunni](https://togithub.com/bashbunni))
- [`bb3e339`](https://togithub.com/charmbracelet/lipgloss/commit/bb3e3398bb98de0faf2966331c4686b360f7eab4): docs(README): match tree example alignment with list examples ([@bashbunni](https://togithub.com/bashbunni))
- [`185fde3`](https://togithub.com/charmbracelet/lipgloss/commit/185fde35318b966319d590e960e3382233f72c6f): docs(README): update tree images ([@bashbunni](https://togithub.com/bashbunni))
- [`ed7f56e`](https://togithub.com/charmbracelet/lipgloss/commit/ed7f56e2a7e910c5a63983683c2d7e387d09d024): docs: fix `CompleteColor` example ([#345](https://togithub.com/charmbracelet/lipgloss/issues/345)) ([@bashbunni](https://togithub.com/bashbunni))
- [`cf0a7c6`](https://togithub.com/charmbracelet/lipgloss/commit/cf0a7c615f558ed2a522babdcf6288f46667a5bb): docs: fix tree screenshot ([@caarlos0](https://togithub.com/caarlos0))
***
Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@charm), or on [Discord](https://charm.sh/chat).
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
v0.12.1
->v0.13.0
Release Notes
charmbracelet/lipgloss (github.com/charmbracelet/lipgloss)
### [`v0.13.0`](https://togithub.com/charmbracelet/lipgloss/releases/tag/v0.13.0) [Compare Source](https://togithub.com/charmbracelet/lipgloss/compare/v0.12.1...v0.13.0) ### Woodn’t you know, Lip Gloss has trees! Lip Gloss ships with a tree rendering sub-package. ```go import "github.com/charmbracelet/lipgloss/tree" ``` Define a new tree. ```go t := tree.Root("."). Child("A", "B", "C") ``` Print the tree. ```go fmt.Println(t) // . // ├── A // ├── B // └── C ``` Trees have the ability to nest. ```go t := tree.Root("."). Child("macOS"). Child( tree.New(). Root("Linux"). Child("NixOS"). Child("Arch Linux (btw)"). Child("Void Linux"), ). Child( tree.New(). Root("BSD"). Child("FreeBSD"). Child("OpenBSD"), ) ``` Print the tree. ```go fmt.Println(t) ```Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.