You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"github.com/pterm/pterm""github.com/pterm/pterm/putils"
)
funcmain() {
// 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()
}
bulletlist/customized
SHOW SOURCE
package main
import (
"github.com/pterm/pterm"
)
funcmain() {
// 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 displayTextStyle: pterm.NewStyle(pterm.FgBlue), // Text colorBulletStyle: pterm.NewStyle(pterm.FgRed), // Bullet color
},
{
Level: 1, // Level 1 (sub-item)Text: "Green", // Text to displayTextStyle: pterm.NewStyle(pterm.FgGreen), // Text colorBullet: "-", // Custom bullet symbolBulletStyle: pterm.NewStyle(pterm.FgLightWhite), // Bullet color
},
{
Level: 2, // Level 2 (sub-sub-item)Text: "Cyan", // Text to displayTextStyle: pterm.NewStyle(pterm.FgCyan), // Text colorBullet: ">", // Custom bullet symbolBulletStyle: pterm.NewStyle(pterm.FgYellow), // Bullet color
},
}
// Create a bullet list with the defined items and render it.pterm.DefaultBulletList.WithItems(bulletListItems).Render()
}