1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
### bulletlist/demo

<details>
<summary>SHOW SOURCE</summary>
```go
package main
import (
"github.com/pterm/pterm"
"github.com/pterm/pterm/putils"
)
func main() {
// Define a list of bullet list items with different levels.
bulletListItems := []pterm.BulletListItem{
{Level: 0, Text: "Level 0"}, // Level 0 item
{Level: 1, Text: "Level 1"}, // Level 1 item
{Level: 2, Text: "Level 2"}, // Level 2 item
}
// Use the default bullet list style to render the list items.
pterm.DefaultBulletList.WithItems(bulletListItems).Render()
// Define a string with different levels of indentation.
text := `0
1
2
3`
// Convert the indented string to a bullet list and render it.
putils.BulletListFromString(text, " ").Render()
}
```
</details>
### bulletlist/customized

<details>
<summary>SHOW SOURCE</summary>
```go
package main
import (
"github.com/pterm/pterm"
)
func main() {
// Define a list of bullet list items with different styles and levels.
bulletListItems := []pterm.BulletListItem{
{
Level: 0, // Level 0 (top level)
Text: "Blue", // Text to display
TextStyle: pterm.NewStyle(pterm.FgBlue), // Text color
BulletStyle: pterm.NewStyle(pterm.FgRed), // Bullet color
},
{
Level: 1, // Level 1 (sub-item)
Text: "Green", // Text to display
TextStyle: pterm.NewStyle(pterm.FgGreen), // Text color
Bullet: "-", // Custom bullet symbol
BulletStyle: pterm.NewStyle(pterm.FgLightWhite), // Bullet color
},
{
Level: 2, // Level 2 (sub-sub-item)
Text: "Cyan", // Text to display
TextStyle: pterm.NewStyle(pterm.FgCyan), // Text color
Bullet: ">", // Custom bullet symbol
BulletStyle: pterm.NewStyle(pterm.FgYellow), // Bullet color
},
}
// Create a bullet list with the defined items and render it.
pterm.DefaultBulletList.WithItems(bulletListItems).Render()
}
```
</details>
|