✨ #PTerm is a modern go module to beautify console output. Featuring charts, progressbars, tables, trees, and many more 🚀 It's completely configurable and 100% cross-platform compatible.

Overview

💻 PTerm | Pretty Terminal Printer

A golang module to print pretty text

Latest Release Stars Forks Issues License: MIT
Downloads
Downloads Forks PTerm

Show Demo Code



PTerm.sh | Installation | Documentation | Quick Start | Examples | Q&A | Contributing


⭐ Main Features

🥅 Goal of PTerm

PTerm is designed to create a platform independent way to create beautiful terminal output. Most modules that want to improve the terminal output do not guarantee platform independence - PTerm does. PTerm follows the most common methods for displaying color in a terminal. With PTerm, it is possible to create beautiful output even in low-level environments.

• 🪀 Easy to use

Our first priority is to keep PTerm as easy to use as possible. With many examples for each individual component, getting started with PTerm is extremely easy. All components are similar in design and implement interfaces to simplify mixing individual components together.

• 🤹‍♀️ Cross-Platform

We take special precautions to ensure that PTerm works on as many operating systems and terminals as possible. Whether it's Windows CMD, macOS iTerm2 or in the backend (for example inside a GitHub Action or other CI systems), PTerm guarantees beautiful output!

PTerm is actively tested on Windows, Linux (Debian & Ubuntu) and macOS.

• 🧪 Well tested

PTerm has a 100% test coverage, which means that every line of code inside PTerm gets tested automatically

We test PTerm continuously. However, since a human cannot test everything all the time, we have our own test system with which we currently run 5447 automated tests to ensure that PTerm has no bugs.

• ✨ Consistent Colors

PTerm uses the ANSI color scheme which is widely used by terminals to ensure consistent colors in different terminal themes. If that's not enough, PTerm can be used to access the full RGB color scheme (16 million colors) in terminals that support TrueColor.

ANSI Colors

• 📚 Component system

PTerm consists of many components, called Printers, which can be used individually or together to generate pretty console output.

• 🛠 Configurable

PTerm can be used by without any configuration. However, you can easily configure each component with little code, so everyone has the freedom to design their own terminal output.

⚠ NOTICE

PTerm is currently under development. It is very likely that not all things will remain as they are at the moment. However, PTerm is still functional. The versioning of PTerm follows the SemVer guidelines. Breaking Changes are explicitly mentioned in the changelogs and the version will be increased accordingly. Everybody is welcome to improve PTerm, whether by making suggestions or pull requests. Thanks ❤

If you want to wait for a stable release, make sure to star the project and follow it, to get notified when we release v1.0.0 (stable) 🚀

📦 Installation

To make PTerm available in your project, you can run the following command.
Make sure to run this command inside your project, when you're using go modules 😉

go get github.com/pterm/pterm

✏ Documentation

To view the official documentation of the latest release, you can go to the automatically generated page of pkg.go.dev This documentation is very technical and includes every method that can be used in PTerm.

For an easy start we recommend that you take a look at the examples section. Here you can see pretty much every feature of PTerm with its source code. The animations of the examples are automatically updated as soon as something changes in PTerm.

Have fun exploring this project 🚀

💖 Contributing

If you have found a bug or want to suggest a feature, you can do so here by opening a new issue.

If you want to contribute to the development of PTerm, you are very welcome to do so. Our contribution guidelines can be found here.

💕 Support

If you want to support me in further developing my open source projects, you can give me a little tip 😄
Your financial support enables me to focus more on my projects. Thank you very much!
Buy Me A Coffee

🧪 Examples

You can find all the examples, with their source code, here: ./_examples

barchart

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	bars := pterm.Bars{
		pterm.Bar{
			Label: "Bar 1",
			Value: 5,
		},
		pterm.Bar{
			Label: "Bar 2",
			Value: 3,
		},
		pterm.Bar{
			Label: "Longer Label",
			Value: 7,
		},
	}

	_ = pterm.DefaultBarChart.WithBars(bars).Render()
	_ = pterm.DefaultBarChart.WithHorizontal().WithBars(bars).Render()
}

bigtext

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print a large text with the LetterStyle from the standard theme.
	// Useful for title screens.
	pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("PTerm")).Render()

	// Print a large text with differently colored letters.
	pterm.DefaultBigText.WithLetters(
		pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgCyan)),
		pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))).
		Render()
}

box

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	panel1 := pterm.DefaultBox.Sprint("Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore\nmagna aliqua.")
	panel2 := pterm.DefaultBox.Sprint("Ut enim ad minim veniam,\nquis nostrud exercitation\nullamco laboris\nnisi ut aliquip\nex ea commodo\nconsequat.")
	panel3 := pterm.DefaultBox.Sprint("Duis aute irure\ndolor in reprehenderit\nin voluptate velit esse cillum\ndolore eu fugiat\nnulla pariatur.")

	panels, _ := pterm.DefaultPanel.WithPanels(pterm.Panels{
		{{Data: panel1}, {Data: panel2}},
		{{Data: panel3}},
	}).Srender()

	pterm.DefaultBox.WithRightPadding(0).WithBottomPadding(0).Println(panels)
}

bulletlist

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print a list with different levels.
	// Useful to generate lists automatically from data.
	pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{
		{Level: 0, Text: "Level 0"},
		{Level: 1, Text: "Level 1"},
		{Level: 2, Text: "Level 2"},
	}).Render()

	// Convert a text to a list and print it.
	pterm.NewBulletListFromString(`0
 1
  2
   3`, " ").Render()
}

bulletlist-custom

Animation

SHOW SOURCE
package main

import (
	"github.com/pterm/pterm"
)

func main() {
	// Print a customized list with different styles and levels.
	pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{
		{Level: 0, Text: "Blue", TextStyle: pterm.NewStyle(pterm.FgBlue), BulletStyle: pterm.NewStyle(pterm.FgRed)},
		{Level: 1, Text: "Green", TextStyle: pterm.NewStyle(pterm.FgGreen), Bullet: "-", BulletStyle: pterm.NewStyle(pterm.FgLightWhite)},
		{Level: 2, Text: "Cyan", TextStyle: pterm.NewStyle(pterm.FgCyan), Bullet: ">", BulletStyle: pterm.NewStyle(pterm.FgYellow)},
	}).Render()
}

center

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	pterm.DefaultCenter.Println("This text is centered!\nIt centeres the whole block by default.\nIn that way you can do stuff like this:")

	// Generate BigLetters
	s, _ := pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString("PTerm")).Srender()
	pterm.DefaultCenter.Println(s) // Print BigLetters with the default CenterPrinter

	pterm.DefaultCenter.WithCenterEachLineSeparately().Println("This text is centered!\nBut each line is\ncentered\nseparately")
}

demo

Animation

SHOW SOURCE
package main

import (
	"math/rand"
	"strconv"
	"strings"
	"time"

	"github.com/pterm/pterm"
)

// Change this to time.Millisecond*200 to speed up the demo.
// Useful when debugging.
const second = time.Second

var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+
	"pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ")

func main() {
	introScreen()
	clear()
	pseudoApplicationHeader()
	time.Sleep(second)
	installingPseudoList()
	time.Sleep(second * 2)
	pterm.DefaultSection.WithLevel(2).Println("Program Install Report")
	installedProgramsSize()
	time.Sleep(second * 4)
	pterm.DefaultSection.Println("Tree Printer")
	installedTree()
	time.Sleep(second * 4)
	pterm.DefaultSection.Println("TrueColor Support")
	fadeText()
	time.Sleep(second)
	pterm.DefaultSection.Println("Bullet List Printer")
	listPrinter()
}

func installedTree() {
	leveledList := pterm.LeveledList{
		pterm.LeveledListItem{Level: 0, Text: "C:"},
		pterm.LeveledListItem{Level: 1, Text: "Go"},
		pterm.LeveledListItem{Level: 1, Text: "Windows"},
		pterm.LeveledListItem{Level: 1, Text: "Programs"},
	}
	for _, s := range pseudoProgramList {
		if s != "pseudo-minecraft" {
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s})
		}
		if s == "pseudo-chrome" {
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"})
		}
	}

	pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render()
}

func installingPseudoList() {
	pterm.DefaultSection.Println("Installing pseudo programs")

	p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start()
	for i := 0; i < p.Total; i++ {
		p.Title = "Installing " + pseudoProgramList[i]
		if pseudoProgramList[i] == "pseudo-minecraft" {
			pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.")
		} else {
			pterm.Success.Println("Installing " + pseudoProgramList[i])
			p.Increment()
		}
		time.Sleep(second / 2)
	}
	p.Stop()
}

func listPrinter() {
	pterm.NewBulletListFromString(`Good bye
 Have a nice day!`, " ").Render()
}

func fadeText() {
	from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point.
	to := pterm.NewRGB(255, 0, 255)   // This RGB value is used as the gradients first point.

	str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)"
	strs := strings.Split(str, "")
	var fadeInfo string // String which will be used to print info.
	// For loop over the range of the string length.
	for i := 0; i < len(str); i++ {
		// Append faded letter to info string.
		fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i])
	}
	pterm.Info.Println(fadeInfo)
}

func installedProgramsSize() {
	d := pterm.TableData{{"Program Name", "Status", "Size"}}
	for _, s := range pseudoProgramList {
		if s != "pseudo-minecraft" {
			d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"})
		} else {
			d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"})
		}
	}
	pterm.DefaultTable.WithHasHeader().WithData(d).Render()
}

func pseudoApplicationHeader() *pterm.TextPrinter {
	return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println(
		"Pseudo Application created with PTerm")
}

func introScreen() {
	pterm.DefaultBigText.WithLetters(
		pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)),
		pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))).
		Render()

	pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println(
		"PTDP - PTerm Demo Program")

	pterm.Info.Println("This animation was generated with the latest version of PTerm!" +
		"\nPTerm works on nearly every terminal and operating system." +
		"\nIt's super easy to use!" +
		"\nIf you want, you can customize everything :)" +
		"\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." +
		"\n" +
		"\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST")))
	pterm.Println()
	introSpinner, _ := pterm.DefaultSpinner.WithRemoveWhenDone(true).Start("Waiting for 15 seconds...")
	time.Sleep(second)
	for i := 14; i > 0; i-- {
		if i > 1 {
			introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...")
		} else {
			introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...")
		}
		time.Sleep(second)
	}
	introSpinner.Stop()
}

func clear() {
	print("\033[H\033[2J")
}

func randomInt(min, max int) int {
	rand.Seed(time.Now().UnixNano())
	return rand.Intn(max-min+1) + min
}

disable-color

Animation

SHOW SOURCE
package main

import (
	"math/rand"
	"strconv"
	"strings"
	"time"

	"github.com/pterm/pterm"
)

// Change this to time.Millisecond*200 to speed up the demo.
// Useful when debugging.
const second = time.Second

var pseudoProgramList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+
	"pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ")

func main() {
	pterm.DisableColor()
	introScreen()
	clear()
	pseudoApplicationHeader()
	time.Sleep(second)
	installingPseudoList()
	time.Sleep(second * 2)
	pterm.DefaultSection.WithLevel(2).Println("Program Install Report")
	installedProgramsSize()
	time.Sleep(second * 4)
	pterm.DefaultSection.Println("Tree Printer")
	installedTree()
	time.Sleep(second * 4)
	pterm.DefaultSection.Println("TrueColor Support")
	fadeText()
	time.Sleep(second)
	pterm.DefaultSection.Println("Bullet List Printer")
	listPrinter()
}

func installedTree() {
	leveledList := pterm.LeveledList{
		pterm.LeveledListItem{Level: 0, Text: "C:"},
		pterm.LeveledListItem{Level: 1, Text: "Go"},
		pterm.LeveledListItem{Level: 1, Text: "Windows"},
		pterm.LeveledListItem{Level: 1, Text: "Programs"},
	}
	for _, s := range pseudoProgramList {
		if s != "pseudo-minecraft" {
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 2, Text: s})
		}
		if s == "pseudo-chrome" {
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Tabs"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Extensions"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "Refined GitHub"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "GitHub Dark Theme"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 3, Text: "pseudo-Bookmarks"})
			leveledList = append(leveledList, pterm.LeveledListItem{Level: 4, Text: "PTerm"})
		}
	}

	pterm.DefaultTree.WithRoot(pterm.NewTreeFromLeveledList(leveledList)).Render()
}

func installingPseudoList() {
	pterm.DefaultSection.Println("Installing pseudo programs")

	p, _ := pterm.DefaultProgressbar.WithTotal(len(pseudoProgramList)).WithTitle("Installing stuff").Start()
	for i := 0; i < p.Total; i++ {
		p.Title = "Installing " + pseudoProgramList[i]
		if pseudoProgramList[i] == "pseudo-minecraft" {
			pterm.Warning.Println("Could not install pseudo-minecraft\nThe company policy forbids games.")
		} else {
			pterm.Success.Println("Installing " + pseudoProgramList[i])
			p.Increment()
		}
		time.Sleep(second / 2)
	}
	p.Stop()
}

func listPrinter() {
	pterm.NewBulletListFromString(`Good bye
 Have a nice day!`, " ").Render()
}

func fadeText() {
	from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point.
	to := pterm.NewRGB(255, 0, 255)   // This RGB value is used as the gradients first point.

	str := "If your terminal has TrueColor support, you can use RGB colors!\nYou can even fade them :)"
	strs := strings.Split(str, "")
	var fadeInfo string // String which will be used to print info.
	// For loop over the range of the string length.
	for i := 0; i < len(str); i++ {
		// Append faded letter to info string.
		fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i])
	}
	pterm.Info.Println(fadeInfo)
}

func installedProgramsSize() {
	d := pterm.TableData{{"Program Name", "Status", "Size"}}
	for _, s := range pseudoProgramList {
		if s != "pseudo-minecraft" {
			d = append(d, []string{s, pterm.LightGreen("pass"), strconv.Itoa(randomInt(7, 200)) + "mb"})
		} else {
			d = append(d, []string{pterm.LightRed(s), pterm.LightRed("fail"), "0mb"})
		}
	}
	pterm.DefaultTable.WithHasHeader().WithData(d).Render()
}

func pseudoApplicationHeader() *pterm.TextPrinter {
	return pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println(
		"Pseudo Application created with PTerm")
}

func introScreen() {
	pterm.DefaultBigText.WithLetters(
		pterm.NewLettersFromStringWithStyle("P", pterm.NewStyle(pterm.FgLightCyan)),
		pterm.NewLettersFromStringWithStyle("Term", pterm.NewStyle(pterm.FgLightMagenta))).
		Render()

	pterm.DefaultHeader.WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Println(
		"PTDP - PTerm Demo Program")

	pterm.Info.Println("This animation was generated with the latest version of PTerm!" +
		"\nPTerm works on nearly every terminal and operating system." +
		"\nIt's super easy to use!" +
		"\nIf you want, you can customize everything :)" +
		"\nYou can see the code of this demo in the " + pterm.LightMagenta("./_examples/demo") + " directory." +
		"\n" +
		"\nThis demo was updated at: " + pterm.Green(time.Now().Format("02 Jan 2006 - 15:04:05 MST")))
	pterm.Println()
	introSpinner, _ := pterm.DefaultSpinner.WithRemoveWhenDone(true).Start("Waiting for 15 seconds...")
	time.Sleep(second)
	for i := 14; i > 0; i-- {
		if i > 1 {
			introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " seconds...")
		} else {
			introSpinner.UpdateText("Waiting for " + strconv.Itoa(i) + " second...")
		}
		time.Sleep(second)
	}
	introSpinner.Stop()
}

func clear() {
	print("\033[H\033[2J")
}

func randomInt(min, max int) int {
	rand.Seed(time.Now().UnixNano())
	return rand.Intn(max-min+1) + min
}

disable-output

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	for i := 0; i < 15; i++ {
		switch i {
		case 5:
			pterm.Info.Println("Disabled Output!")
			pterm.DisableOutput()
		case 10:
			pterm.EnableOutput()
			pterm.Info.Println("Enabled Output!")
		}

		pterm.Printf("Printing something... [%d/%d]\n", i, 15)
	}
}

header

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print a default header.
	pterm.DefaultHeader.Println("This is the default header!")
}

header-custom

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// All available options: https://pkg.go.dev/github.com/pterm/pterm#HeaderPrinter

	// Build on top of DefaultHeader
	pterm.DefaultHeader. // Use DefaultHeader as base
				WithMargin(15).
				WithBackgroundStyle(pterm.NewStyle(pterm.BgCyan)).
				WithTextStyle(pterm.NewStyle(pterm.FgBlack)).
				Println("This is a custom header!")
	// Instead of printing the header you can set it to a variable.
	// You can then reuse your custom header.

	// Making a completely new HeaderPrinter
	newHeader := pterm.HeaderPrinter{
		TextStyle:       pterm.NewStyle(pterm.FgBlack),
		BackgroundStyle: pterm.NewStyle(pterm.BgRed),
		Margin:          20,
	}

	// Print header.
	newHeader.Println("This is a custom header!")
}

override-default-printers

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print default error.
	pterm.Error.Println("This is the default Error")

	// Customize default error.
	pterm.Error.Prefix = pterm.Prefix{
		Text:  "OVERRIDE",
		Style: pterm.NewStyle(pterm.BgCyan, pterm.FgRed),
	}

	// Print new default error.
	pterm.Error.Println("This is the default Error after the prefix was overridden")
}

panel

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Declare panels in a two dimensional grid system.
	panels := pterm.Panels{
		{{Data: "This is the first panel"}, {Data: pterm.DefaultHeader.Sprint("Hello, World!")}, {Data: "This\npanel\ncontains\nmultiple\nlines"}},
		{{Data: pterm.Red("This is another\npanel line")}, {Data: "This is the second panel\nwith a new line"}},
	}

	// Print panels.
	_ = pterm.DefaultPanel.WithPanels(panels).WithPadding(5).Render()
}

paragraph

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print long text with default paragraph printer.
	pterm.DefaultParagraph.Println("This is the default paragraph printer. As you can see, no words are separated, " +
		"but the text is split at the spaces. This is useful for continuous text of all kinds. You can manually change the line width if you want to." +
		"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam")

	// Print one line space.
	pterm.Println()

	// Print long text without paragraph printer.
	pterm.Println("This text is written with the default Println() function. No intelligent splitting here." +
		"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam")
}

paragraph-custom

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print a paragraph with a custom maximal width.
	pterm.DefaultParagraph.WithMaxWidth(60).Println("This is a custom paragraph printer. As you can see, no words are separated, " +
		"but the text is split at the spaces. This is useful for continuous text of all kinds. You can manually change the line width if you want to." +
		"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam")

	// Print one line space.
	pterm.Println()

	// Print text without a paragraph printer.
	pterm.Println("This text is written with the default Println() function. No intelligent splitting here." +
		"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam")
}

prefix

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Enable debug messages.
	pterm.EnableDebugMessages()

	pterm.Debug.Println("Hello, World!")   // Print Debug.
	pterm.Info.Println("Hello, World!")    // Print Info.
	pterm.Success.Println("Hello, World!") // Print Success.
	pterm.Warning.Println("Hello, World!") // Print Warning.
	pterm.Error.Println("Hello, World!")   // Print Error.
	// Temporarily set Fatal to false, so that the CI won't crash.
	pterm.Fatal.WithFatal(false).Println("Hello, World!") // Print Fatal.
}

print-basic-text

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// A BasicText printer is used to print text, without special formatting.
	// As it implements the TextPrinter interface, you can use it in combination with other printers.
	pterm.DefaultBasicText.Println("Default basic text printer.")
	pterm.DefaultBasicText.Println("Can be used in any" + pterm.LightMagenta(" TextPrinter ") + "context.")
	pterm.DefaultBasicText.Println("For example to resolve progressbars and spinners.")
	// If you just want to print text, you should use this instead:
	// 	pterm.Println("Hello, World!")
}

print-color-fade

Animation

SHOW SOURCE
package main

import (
	"github.com/pterm/pterm"
)

func main() {
	// Print info.
	pterm.Info.Println("RGB colors only work in Terminals which support TrueColor.")

	from := pterm.NewRGB(0, 255, 255) // This RGB value is used as the gradients start point.
	to := pterm.NewRGB(255, 0, 255)   // This RGB value is used as the gradients end point.

	// For loop over the range of the terminal height.
	for i := 0; i < pterm.GetTerminalHeight()-2; i++ {
		// Print string which is colored with the faded RGB value.
		from.Fade(0, float32(pterm.GetTerminalHeight()-2), float32(i), to).Println("Hello, World!")
	}
}

print-color-fade-multiple

Animation

SHOW SOURCE
package main

import (
	"strings"

	"github.com/pterm/pterm"
)

func main() {
	from := pterm.NewRGB(0, 255, 255)  // This RGB value is used as the gradients start point.
	to := pterm.NewRGB(255, 0, 255)    // This RGB value is used as the gradients first point.
	to2 := pterm.NewRGB(255, 0, 0)     // This RGB value is used as the gradients second point.
	to3 := pterm.NewRGB(0, 255, 0)     // This RGB value is used as the gradients third point.
	to4 := pterm.NewRGB(255, 255, 255) // This RGB value is used as the gradients end point.

	str := "RGB colors only work in Terminals which support TrueColor."
	strs := strings.Split(str, "")
	var fadeInfo string // String which will be used to print info.
	// For loop over the range of the string length.
	for i := 0; i < len(str); i++ {
		// Append faded letter to info string.
		fadeInfo += from.Fade(0, float32(len(str)), float32(i), to).Sprint(strs[i])
	}

	// Print info.
	pterm.Info.Println(fadeInfo)

	// For loop over the range of the terminal height.
	for i := 0; i < pterm.GetTerminalHeight()-2; i++ {
		// Print string which is colored with the faded RGB value.
		from.Fade(0, float32(pterm.GetTerminalHeight()-2), float32(i), to, to2, to3, to4).Println("Hello, World!")
	}
}

print-color-rgb

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print strings with a custom RGB color.
	// NOTICE: This only works with terminals which support TrueColor.
	pterm.NewRGB(178, 44, 199).Println("This text is printed with a custom RGB!")
	pterm.NewRGB(15, 199, 209).Println("This text is printed with a custom RGB!")
	pterm.NewRGB(201, 144, 30).Println("This text is printed with a custom RGB!")
}

print-with-color

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print different colored words.
	pterm.Println(pterm.Red("Hello, ") + pterm.Green("World") + pterm.Cyan("!"))
	pterm.Println(pterm.Red("Even " + pterm.Cyan("nested ") + pterm.Green("colors ") + "are supported!"))

	// Print strings with set color.
	pterm.FgBlack.Println("FgBlack")
	pterm.FgRed.Println("FgRed")
	pterm.FgGreen.Println("FgGreen")
	pterm.FgYellow.Println("FgYellow")
	pterm.FgBlue.Println("FgBlue")
	pterm.FgMagenta.Println("FgMagenta")
	pterm.FgCyan.Println("FgCyan")
	pterm.FgWhite.Println("FgWhite")
	pterm.Println() // Print one line space.
	pterm.FgLightRed.Println("FgLightRed")
	pterm.FgLightGreen.Println("FgLightGreen")
	pterm.FgLightYellow.Println("FgLightYellow")
	pterm.FgLightBlue.Println("FgLightBlue")
	pterm.FgLightMagenta.Println("FgLightMagenta")
	pterm.FgLightCyan.Println("FgLightCyan")
	pterm.FgLightWhite.Println("FgLightWhite")
}

progressbar

Animation

SHOW SOURCE
package main

import (
	"strings"
	"time"

	"github.com/pterm/pterm"
)

// Slice of strings with placeholder text.
var fakeInstallList = strings.Split("pseudo-excel pseudo-photoshop pseudo-chrome pseudo-outlook pseudo-explorer "+
	"pseudo-dops pseudo-git pseudo-vsc pseudo-intellij pseudo-minecraft pseudo-scoop pseudo-chocolatey", " ")

func main() {
	// Create progressbar as fork from the default progressbar.
	p, _ := pterm.DefaultProgressbar.WithTotal(len(fakeInstallList)).WithTitle("Downloading stuff").Start()

	for i := 0; i < p.Total; i++ {
		p.Title = "Downloading " + fakeInstallList[i]              // Update the title of the progressbar.
		pterm.Success.Println("Downloading " + fakeInstallList[i]) // If a progressbar is running, each print will be printed above the progressbar.
		p.Increment()                                              // Increment the progressbar by one. Use Add(x int) to increment by a custom amount.
		time.Sleep(time.Millisecond * 350)                         // Sleep 350 milliseconds.
	}
}

section

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Print a section with level one.
	pterm.DefaultSection.Println("This is a section!")
	// Print placeholder.
	pterm.Info.Println("And here is some text.\nThis text could be anything.\nBasically it's just a placeholder")

	// Print a section with level two.
	pterm.DefaultSection.WithLevel(2).Println("This is another section!")
	// Print placeholder.
	pterm.Info.Println("And this is\nmore placeholder text")
}

spinner

Animation

SHOW SOURCE
package main

import (
	"time"

	"github.com/pterm/pterm"
)

func main() {
	// Create and start a fork of the default spinner.
	spinnerSuccess, _ := pterm.DefaultSpinner.Start("Doing something important... (will succeed)")
	time.Sleep(time.Second * 3) // Simulate 3 seconds of processing something.
	spinnerSuccess.Success()    // Resolve spinner with success message.

	// Create and start a fork of the default spinner.
	spinnerWarning, _ := pterm.DefaultSpinner.Start("Doing something important... (will warn)")
	time.Sleep(time.Second * 3) // Simulate 3 seconds of processing something.
	spinnerWarning.Warning()    // Resolve spinner with warning message.

	// Create and start a fork of the default spinner.
	spinnerFail, _ := pterm.DefaultSpinner.Start("Doing something important... (will fail)")
	time.Sleep(time.Second * 3) // Simulate 3 seconds of processing something.
	spinnerFail.Fail()          // Resolve spinner with error message.

	// Create and start a fork of the default spinner.
	spinnerLiveText, _ := pterm.DefaultSpinner.Start("Doing a lot of stuff...")
	time.Sleep(time.Second * 2)                      // Simulate 2 seconds of processing something.
	spinnerLiveText.UpdateText("It's really much")   // Update spinner text.
	time.Sleep(time.Second * 2)                      // Simulate 2 seconds of processing something.
	spinnerLiveText.UpdateText("We're nearly done!") // Update spinner text.
	time.Sleep(time.Second * 2)                      // Simulate 2 seconds of processing something.
	spinnerLiveText.Success("Finally!")              // Resolve spinner with success message.
}

table

Animation

SHOW SOURCE
package main

import "github.com/pterm/pterm"

func main() {
	// Create a fork of the default table, fill it with data and print it.
	// Data can also be generated and inserted later.
	pterm.DefaultTable.WithHasHeader().WithData(pterm.TableData{
		{"Firstname", "Lastname", "Email"},
		{"Paul", "Dean", "[email protected]"},
		{"Callie", "Mckay", "[email protected]"},
		{"Libby", "Camacho", "[email protected]"},
	}).Render()
}

theme

Animation

SHOW SOURCE
package main

import (
	"github.com/pterm/pterm"
	"reflect"
	"time"
)

func main() {
	// Print info.
	pterm.Info.Println("These are the default theme styles.\n" +
		"You can modify them easily to your personal preference,\n" +
		"or create new themes from scratch :)")

	pterm.Println() // Print one line space.

	// Print every value of the default theme with its own style.
	v := reflect.ValueOf(pterm.ThemeDefault)
	typeOfS := v.Type()

	if typeOfS == reflect.TypeOf(pterm.Theme{}) {
		for i := 0; i < v.NumField(); i++ {
			field, ok := v.Field(i).Interface().(pterm.Style)
			if ok {
				field.Println(typeOfS.Field(i).Name)
			}
			time.Sleep(time.Millisecond * 250)
		}
	}
}

tree

Animation

SHOW SOURCE
package main

import (
	"github.com/pterm/pterm"
)

func main() {
	// You can use a LeveledList here, for easy generation.
	leveledList := pterm.LeveledList{
		pterm.LeveledListItem{Level: 0, Text: "C:"},
		pterm.LeveledListItem{Level: 1, Text: "Users"},
		pterm.LeveledListItem{Level: 1, Text: "Windows"},
		pterm.LeveledListItem{Level: 1, Text: "Programs"},
		pterm.LeveledListItem{Level: 1, Text: "Programs(x86)"},
		pterm.LeveledListItem{Level: 1, Text: "dev"},
		pterm.LeveledListItem{Level: 0, Text: "D:"},
		pterm.LeveledListItem{Level: 0, Text: "E:"},
		pterm.LeveledListItem{Level: 1, Text: "Movies"},
		pterm.LeveledListItem{Level: 1, Text: "Music"},
		pterm.LeveledListItem{Level: 2, Text: "LinkinPark"},
		pterm.LeveledListItem{Level: 1, Text: "Games"},
		pterm.LeveledListItem{Level: 2, Text: "Shooter"},
		pterm.LeveledListItem{Level: 3, Text: "CallOfDuty"},
		pterm.LeveledListItem{Level: 3, Text: "CS:GO"},
		pterm.LeveledListItem{Level: 3, Text: "Battlefield"},
		pterm.LeveledListItem{Level: 4, Text: "Battlefield 1"},
		pterm.LeveledListItem{Level: 4, Text: "Battlefield 2"},
		pterm.LeveledListItem{Level: 0, Text: "F:"},
		pterm.LeveledListItem{Level: 1, Text: "dev"},
		pterm.LeveledListItem{Level: 2, Text: "dops"},
		pterm.LeveledListItem{Level: 2, Text: "PTerm"},
	}

	// Generate tree from LeveledList.
	root := pterm.NewTreeFromLeveledList(leveledList)

	// Render TreePrinter
	pterm.DefaultTree.WithRoot(root).Render()
}

GitHub @pterm  Â·  Author @MarvinJWendt | PTerm.sh

Issues
  • The progress bar of the windows system shows some problems

    The progress bar of the windows system shows some problems

    image

    bug unreproducable 
    opened by fguby 14
  • boxed table - style is not reset between cells

    boxed table - style is not reset between cells

    Hi. Thank you for this great project.

    I notice that when a cell contains a string formated with style (i.e bold or italic), the next cell is "infected" with the same style. This is only reproducible in boxed mode.

    concider the following code:

    func TestBox(t *testing.T) {
    	line := pterm.Italic.Sprint("italic")
    
    
    	table, _ := pterm.DefaultTable.WithBoxed().WithData(
    		[][]string{
    			{line, "a", "b", "c"},
    		}).Srender()
    
    	fmt.Println(table)
    
    	table, _ = pterm.DefaultTable.WithData(
    		[][]string{
    			{line, "a", "b", "c"},
    		}).Srender()
    
    	fmt.Println(table)
    
    	pterm.DefaultBox.Println(table)
    }
    
    

    I get the following. You can see that the normal table renders fine, but in box-mode - all the rest of the line is italic.

    Screenshot from 2021-07-29 01-43-51

    This is probably a problem with BoxPrinter, as you can see with:

    pterm.DefaultBox.Println("normal", pterm.Bold.Sprint("bold."), "this should not be bold\nnewline fixes")
    

    Thank you.

    bug critical 
    opened by kjellkvinge 11
  • Add spaces between operands by default

    Add spaces between operands by default

    Hi Marvin,

    This is the FR as per our discussion (linked at the end).

    One thing that I noticed is the following:

    When I run

    package main
    
    import (
    	"fmt"
    )
    
    func main() {
    	const name, age = "Kim", 22
    	fmt.Println(name, "is", age, "years old.")
    }
    

    I get

    Kim is 22 years old.

    while

    package main
    
    import (
    	"github.com/pterm/pterm"
    )
    
    func main() {
    	const name, age = "Kim", 22
    	pterm.Println(name, "is", age, "years old.")
    }
    

    produces

    Kimis22years old.

    The example is taken from Golang's documentation here which states "Spaces are always added between operands".

    Thanks!

    Originally posted by @m5lk3n in https://github.com/pterm/pterm/discussions/66#discussioncomment-269543

    bug proposal in progress 
    opened by m5lk3n 8
  • Allow Disabling Prefixes in PrefixPrinters.

    Allow Disabling Prefixes in PrefixPrinters.

    I am currently trying to use pterm and would like to offer my users an option to output as plain text.

    I'd like to use prefix printers (pterm.Info.Println("")) throughout my code, but if I want to offer plain text output, the prefix becomes a problem.

    It would be great to have a way to disable prefixes completely using a "global" switch, similar to pterm.DisableColor() or pterm.DisableDebugMessages().

    When the switch is used, the following behaviour would be great:

    pterm.DisablePrefixes()
    pterm.Info.Println("Hello World") // Output: Hello World
    
    pterm.EnablePrefixes()
    pterm.Info.Println("Hello World") // Output: [ INFO ] Hello World
    
    proposal in progress 
    opened by jenslauterbach 7
  • Add theme support

    Add theme support

    Add theme support to PTerm.

    • Theme should be a struct.
    • A default theme should be used for default printers.
    • Each printer should have a theme option.

    Theme Support

    • [x] PrefixPrinter
    • [x] HeaderPrinter
    • [x] Progressbar
    • [x] Spinner
    • [x] Table
    • [x] Section

    Current progress in https://github.com/pterm/pterm/tree/feat/theme-support

    proposal breaking Hacktoberfest 
    opened by MarvinJWendt 6
  • Raw output not working for Section and BasicText

    Raw output not working for Section and BasicText

    Description

    The following code produce an incorrect output when using --raw:

    headerPrinter = pterm.DefaultBasicText.WithStyle(pterm.NewStyle(pterm.Bold))
    
    table := pterm.Panels{
    		{
    			{Data: headerPrinter.Sprint("Name")},
    			{Data: headerPrinter.Sprint("Template")},
    			{Data: headerPrinter.Sprint("Components")},
    		},
    	}
    
    panel, err := pterm.DefaultPanel.
    		WithPanels(table).
    		WithPadding(2).
    		WithSameColumnWidth().
    		Srender()
    
    section := pterm.DefaultSection.
    		WithStyle(pterm.NewStyle(pterm.Bold, pterm.FgCyan)).
    		Sprint("Applications")
    
    pterm.Print(section)
    pterm.Print(panel)
    

    Output:

    # Applications
    Name
    
    Template
    
    Components
    
    
    restql-sample-app
    
    [email protected]
    
    restql-sample-server: [email protected]
    restql-sample-server-2: [email protected]
    
    
    
    # Templates
    Name
    
    Components
    
    
    restql-sample-template
    
    restql-sample-server: [email protected]
    
    image

    Environment

    go env output:

    GO111MODULE=""
    GOARCH="arm64"
    GOBIN="/Users/caioferreira/.asdf/installs/golang/1.16.7/bin"
    GOCACHE="/Users/caioferreira/Library/Caches/go-build"
    GOENV="/Users/caioferreira/Library/Application Support/go/env"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="arm64"
    GOHOSTOS="darwin"
    GOINSECURE=""
    GOMODCACHE="/Users/caioferreira/.asdf/installs/golang/1.16.7/packages/pkg/mod"
    GONOPROXY=""
    GONOSUMDB=""
    GOOS="darwin"
    GOPATH="/Users/caioferreira/.asdf/installs/golang/1.16.7/packages"
    GOPRIVATE=""
    GOPROXY="https://proxy.golang.org,direct"
    GOROOT="/Users/caioferreira/.asdf/installs/golang/1.16.7/go"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/Users/caioferreira/.asdf/installs/golang/1.16.7/go/pkg/tool/darwin_arm64"
    GOVCS=""
    GOVERSION="go1.16.7"
    GCCGO="gccgo"
    AR="ar"
    CC="clang"
    CXX="clang++"
    CGO_ENABLED="1"
    GOMOD="/Users/caioferreira/workspace/b2w/devops/metaplane-cli/go.mod"
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fx/jq71n_n55l34mm2y5zcp1wtw0000gn/T/go-build1441398178=/tmp/go-build -gno-record-gcc-switches -fno-common"
    
    bug documentation 
    opened by caiorcferreira 6
  • feat(progressbar): add RemoveWhenDone

    feat(progressbar): add RemoveWhenDone

    Description

    Added option to remove Progress Bar when it's done.

    Scope

    What is affected by this pull request?

    • [ ] Bug Fix
    • [X] New Feature
    • [ ] Documentation
    • [ ] Other

    Related Issue

    Fixes #11

    To-Do Checklist

    • [X] I tested my changes
    • [X] I have commented every method that I created/changed
    • [ ] I updated the examples to fit with my changes
    • [ ] I have added tests for my newly created methods
    Hacktoberfest hacktoberfest-accepted 
    opened by VictorAssunc 6
  • multi line DefaultCenter and DefaultHeader broken

    multi line DefaultCenter and DefaultHeader broken

    when i run the below code to have a 2 line header or just center block it doesnt work

    pterm.DefaultCenter.Print(pterm.DefaultHeader.WithFullWidth().WithBackgroundStyle(pterm.NewStyle(pterm.BgLightBlue)).WithMargin(10).Sprint("First line\nsecond Line"))

    bug in progress 
    opened by xbipin 6
  • Option to remove `Progressbar` when done

    Option to remove `Progressbar` when done

    Add an option to remove Progressbar when done.

    proposal good first issue Hacktoberfest 
    opened by MarvinJWendt 6
  • Add `TextPrinter` variant which prints normal text

    Add `TextPrinter` variant which prints normal text

    Add TextPrinter variant which prints normal text - this can be used to resolve progressbars and spinners for example.

    proposal good first issue Hacktoberfest 
    opened by MarvinJWendt 6
  • Add ability to set custom io.writter for each of the different output levels

    Add ability to set custom io.writter for each of the different output levels

    This would allow for errors to be written to standard error or for debug logs to be written to a file.

    proposal proposal-accepted 
    opened by Brookke 3
  • DefaultBigText  Style problem

    DefaultBigText Style problem

    macos ZSH_THEME="powerlevel9k/powerlevel9k" Hack nerd font

    image

    image

    bug unreproducable 
    opened by redtoolskobe 5
  • Automatically generate website docs in the CI process

    Automatically generate website docs in the CI process

    This is a rather huge thing, but we should write a CI system to automatically generate the docs for https://pterm.sh Currently, documenting the functions of PTerm is time-consuming and a boring task. Automating the docs will make working on PTerm more efficient and more fun.

    proposal proposal-accepted 
    opened by MarvinJWendt 0
  • Add snapshot testing

    Add snapshot testing

    Now that we have implemented testza, we should optimize the testing process. An important step is, to introduce Snapshot testing. We can create a Snapshot for every Printer, to validate its correct output.

    proposal proposal-accepted 
    opened by MarvinJWendt 0
  • Multiple bars for 1 label and different styles for each bar for the bar chart and a legend for the bars

    Multiple bars for 1 label and different styles for each bar for the bar chart and a legend for the bars

    Maybe it would be nice to have multiple bars per label and different styles for each bar for the bar chart, and a legend for these bars to differentiate them. 📊

    proposal proposal-accepted 
    opened by floaust 5
  • a function to print using a ANSI standard writer

    a function to print using a ANSI standard writer

    Hello, I'm trying to use tview module for get data and pterm to print results, but I wasn't been able to print any liveprinter type on terminal, using tview's AnsiWriter method, that returns a io.writer, and setted it as pterm's default output.

    Attach a capture about how it looks a progressBar using tview's AnsiWriter. image

    proposal 
    opened by Lirb 0
  • Set Table size

    Set Table size

    Is there any way to set the table size? I have three different tables I want to print, one after the other, and for continuity purposes, it would look much better if they were all aligned to the same size, rather than the current variable size (depending on the size of the longest string in a column).

    proposal proposal-accepted 
    opened by dfreilich 1
  • propsal: Implement FigletPrinter as an alternative to BigTextPrinter

    propsal: Implement FigletPrinter as an alternative to BigTextPrinter

    The FigletPrinter could use alternative figlet font files.

    There is a go module to read figlet font files https://github.com/lukesampson/figlet/figletlib which can parse the figlet font file format. (https://github.com/lukesampson/figlet/blob/master/figfont.txt)

    You can read more about figlet fonts and see examples at: http://www.figlet.org/

    I'm willing to add this feature

    proposal proposal-accepted 
    opened by tw1nk 2
  • Table align right

    Table align right

    It would be great to have a align right option for tablet data

    proposal proposal-accepted 
    opened by xbipin 1
  • can run multi Spinner in at the same time

    can run multi Spinner in at the same time

    like this:

    // Create and start a fork of the default spinner.
    	spinnerSuccess, _ := pterm.DefaultSpinner.Start("Doing something important... (will succeed)\n")
    	go func() {
    		time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something.
    		spinnerSuccess.Success()    // Resolve spinner with success message.
    	}()
    
    	// Create and start a fork of the default spinner.
    	spinnerWarning, _ := pterm.DefaultSpinner.Start("Doing something important... (will warn)\n")
    	go func() {
    		time.Sleep(time.Second * 2) // Simulate 3 seconds of processing something.
    		spinnerWarning.Warning()    // Resolve spinner with warning message.
    	}()
    
    proposal proposal-accepted 
    opened by goodking-bq 1
Releases(v0.12.31)
  • v0.12.31(Sep 21, 2021)

  • v0.12.30(Aug 16, 2021)

  • v0.12.29(Jul 21, 2021)

    Features

    • putils: add PrintAverageExecutionTime

    Test

    • fix rgb error test
    • fix internal test import cycle
    • move tests into own package

    Code Refactoring

    • replace testify with testza
    Source code(tar.gz)
    Source code(zip)
  • v0.12.28(Jul 17, 2021)

    Features

    • spinner: add option to show a timer

    Bug Fixes

    • bar chart: fix panic when rendering empty horizontal bar chart

    Test

    • spinner: try to fix RawOutput test
    • spinner: add raw output test

    Code Refactoring

    • spinner: better raw output logic
    • spinner: refactor
    Source code(tar.gz)
    Source code(zip)
  • v0.12.27(Jul 5, 2021)

  • v0.12.26(Jul 1, 2021)

  • v0.12.25(Jul 1, 2021)

  • v0.12.24(Jun 14, 2021)

    Features

    • boxprinter: replace line breaks in title with space
    • boxprinter: add title center position to BoxPrinter
    • boxprinter: add title & title position to BoxPrinter
    • boxprinter: add title & title position to BoxPrinter
    • putils: add TableDataFromSeparatedValues
    • putils: add TableDataFromTSV
    • putils: add TableDataFromCSV
    • putils: add function to convert TSV to TableData
    • putils: add function to convert CSV to TableData
    Source code(tar.gz)
    Source code(zip)
  • v0.12.23(Jun 7, 2021)

  • v0.12.22(May 30, 2021)

  • v0.12.21(May 30, 2021)

    Chore

    • github: remove issue template config.yml

    Code Refactoring

    • putils: change internal variable name

    Documentation Changes

    • putils: add contributing notice to readme

    Features

    • print lines above active spinners
    • putils: add DownloadFileWithProgressbar

    Style

    • lint: fix linting error

    Test

    • clear active spinners after tests complete
    Source code(tar.gz)
    Source code(zip)
  • v0.12.20(May 29, 2021)

    Features

    • force color output by default

    Ci

    • create putils README from template
    • automatically write putils docs to pterm.sh

    Documentation Changes

    • pterm-sh: move putils section up in sidebar
    • pterm-sh: add putils docs to sidebar
    • putils: add pkg.go.dev docs link
    • putils: add better docs to putils
    • readme: update pkg.go.dev link to point to the docs section directly
    • readme: disable link styling in badges
    Source code(tar.gz)
    Source code(zip)
  • v0.12.19(May 29, 2021)

  • v0.12.18(May 22, 2021)

  • v0.12.17(May 14, 2021)

  • v0.12.16(May 13, 2021)

  • v0.12.15(May 13, 2021)

    Features

    • add raw output mode for BarChart
    • add disable styling boolean option
    • bigtext: add raw output mode
    • centerprinter: add raw output mode
    • headerprinter: add raw output mode
    • panelprinter: add raw output mode
    • paragraph: add raw output mode
    • prefix: add PrintIfError
    • prefix: add raw output mode
    • progressbar: add raw output mode
    • spinner: add raw output mode
    Source code(tar.gz)
    Source code(zip)
  • v0.12.14(May 9, 2021)

    Bug Fixes

    • header: fix inline color in Header

    Features

    • basic-text: add Sprintfln and Printfln function
    • boxprinter: add Sprintfln and Printfln function
    • centerprinter: add Sprintfln and Printfln function
    • color: add Sprintfln and Printfln function
    • header: add Sprintfln and Printfln function
    • paragraph: add Sprintfln and Printfln function
    • prefix: add Sprintfln and Printfln function
    • print: add Sprintfln and Printfln function
    • printer-interface: add Sprintfln and Printfln to the interface
    • rgb: add Sprintfln and Printfln function
    • section: add Sprintfln and Printfln function

    Ci

    • try to render SVGs with monospace font
    • try to render SVGs with monospace font
    • change color scheme for rendered examples

    Code Refactoring

    • refactor Sprintfln and Printfln func. for better performance

    Test

    • add tests for Sprintfln and Printfln function

    Reverts

    • ci: change color scheme for rendered examples
    Source code(tar.gz)
    Source code(zip)
  • v0.12.13(Apr 10, 2021)

    Bug Fixes

    • bigtext: fix height of some characters #180
    • color: make color implement TextPrinter

    Chore

    • deps: bump github.com/gookit/color from 1.4.0 to 1.4.1
    • deps: bump github.com/gookit/color from 1.3.8 to 1.4.0
    • deps: bump github.com/mattn/go-runewidth from 0.0.10 to 0.0.12
    • gitpod: add gitpod support (#172)

    Code Refactoring

    • examples: center the intro of demo
    • examples: add note to box printer

    Test

    • add interface tests
    Source code(tar.gz)
    Source code(zip)
  • v0.12.12(Mar 1, 2021)

    Chore

    • deps: bump github.com/gookit/color from 1.3.7 to 1.3.8

    Code Refactoring

    • examples: Update PrefixPrinter example

    Features

    • prefixprinter: Add option to show line number of caller
    Source code(tar.gz)
    Source code(zip)
  • v0.12.11(Feb 25, 2021)

  • v0.12.10(Feb 25, 2021)

    Bug Fixes

    • correct pterm.Println() behaviour to fit to fmt.Println() in every TextPrinter

    Chore

    • intellij: update VersionControlSystem config
    Source code(tar.gz)
    Source code(zip)
  • v0.12.9(Feb 23, 2021)

    Bug Fixes

    • correct pterm.Println() behaviour to fit to fmt.Println()
    • change terminal package import path to updated version

    Chore

    • deps: update dependencies
    Source code(tar.gz)
    Source code(zip)
  • v0.12.8(Dec 11, 2020)

    Bug Fixes

    • revert change horizontal string change

    Chore

    • intellij: update conventionalCommit.xml

    Code Refactoring

    • remove analytics
    • boxprinter: change from RenderablePrinter to TextPrinter
    • boxprinter: return theme when style is nil
    • boxprinter: change DefaultBox top and bottom padding to 0
    • boxprinter: fix spacing between boxes and in boxes
    • boxprinter: refactor code
    • panelprinter: optional border for Panel
    • panelprinter: add BoxPrinter to surround panels with a fully custom box

    Documentation Changes

    • boxprinter: update BoxPrinter example
    • boxprinter: update documentation to printer
    • boxprinter: add documentation
    • examples: add example for BoxPrinter
    • examples: change example for BoxPrinter
    • pterm-sh: add BoxPrinter
    • pterm-sh: update sidebar
    • readme: update readme with new main features

    Features

    • boxprinter: add WithHorizontalString to BoxPrinter
    • boxprinter: add BoxPrinter
    • panel: add optional border for Panel
    • panelprinter: add theme support to PanelPrinter
    • theme: add BoxStyle and BoxTextStyle
    • theme: add optional theme for border in Panel

    Style

    • fix go vet issue
    • panelprinter: bottom padding in PanelPrinter

    Test

    • boxprinter: add test
    • boxprinter: test multiple lines in one box
    • boxprinter: add tests for BoxPrinter
    • panelprinter: add tests for adding box printer
    • panelprinter: add tests for optional border for Panel
    • theme: add tests for BoxStyle and BoxTextStyle
    Source code(tar.gz)
    Source code(zip)
  • v0.12.7(Nov 24, 2020)

    Bug Fixes

    • center bars over colored labels in BarChart

    Documentation Changes

    • change Template to BarChart
    • fix readme formatting
    • add buymeacoffee link to readme
    • contributing: update contributing file
    • funding: add buymeacoffee link to FUNDING.yml
    • pterm-sh: add docs for BarChartPrinter
    • pterm-sh: remove empty codeblock
    • readme: add emoji to support section
    • readme: add spacing between text

    Features

    • add values to chart
    • add horizontal BarChartPrinter
    • add BarChartPrinter
    • add BarChartPrinter
    • add BarChartPrinter
    • theme: add theme support to BarChart

    Test

    • add tests to BarChartPrinter
    Source code(tar.gz)
    Source code(zip)
  • v0.12.6(Nov 17, 2020)

  • v0.12.5(Nov 17, 2020)

  • v0.12.4(Nov 17, 2020)

    Bug Fixes

    • fix Printf of PrefixPrinter

    Ci

    • count tests from all packages
    • read stderr to count unit tests
    • try to repeat unittest count

    Documentation Changes

    • contributing: change examples to return error (#145)

    Revert

    • "ci: try to repeat unittest count"

    Style

    • remove commented code
    Source code(tar.gz)
    Source code(zip)
  • v0.12.3(Nov 12, 2020)

    Chore

    • deps: update dependencies

    Ci

    • disable ubuntu and macOS tests
    • disable parallel unit test counting
    • fix generation of readmes
    • disable bodyclose
    • add stats
    • disable parallel tests
    • add timeout to unittests
    • add json output on unittest count fail

    Test

    • reduce tests
    • different test logic for rgb printing
    • add better test names for RGB tests
    Source code(tar.gz)
    Source code(zip)
  • v0.12.2(Nov 4, 2020)

    Bug Fixes

    • fix internal GetStringMaxWidth max width

    Chore

    • intellij: add conventional commit linting defaults

    Ci

    • only count tests in pterm package
    • change svg font to JetBrains Mono

    Code Refactoring

    • use pterm.Sprint to print

    Documentation Changes

    • code: fix Printo comment
    • panel: update example
    • pterm-sh: move bulletlistitem.md into types directory
    • pterm-sh: remove variables for now
    • pterm-sh: add print methods documentation
    • pterm-sh: move printer files in own directory
    • pterm-sh: add better structure to the documentation
    • pterm-sh: add functions with descriptions
    • pterm-sh: update sidebar
    • pterm-sh: add panel-printer
    • pterm-sh: update sidebar
    • pterm-sh: sort sidebar
    • pterm-sh: rename basictext.md to basictext-printer.md
    • pterm-sh: update sidebar
    • pterm-sh: add basictext
    • pterm-sh: make writing-documentation-template.md to a codeblock again
    • pterm-sh: add custom functions to writing-documentation-template.md
    • pterm-sh: change basic usage of progressbar
    • pterm-sh: rename printer documentation files
    • pterm-sh: update sidebar
    • pterm-sh: add tree
    • pterm-sh: add table
    • pterm-sh: update sidebar
    • pterm-sh: change bool to ...bool
    • pterm-sh: add spinner
    • pterm-sh: update sidebar
    • pterm-sh: update sidebar
    • pterm-sh: add section
    • pterm-sh: add progressbar
    • pterm-sh: update sidebar
    • pterm-sh: update sidebar
    • pterm-sh: add paragraph
    • pterm-sh: change to same naming convention
    • pterm-sh: add header
    • pterm-sh: update sidebar
    • pterm-sh: update sidebar
    • pterm-sh: add center
    • pterm-sh: add bulletlistitem
    • pterm-sh: add bulletlist
    • pterm-sh: update sidebar
    • pterm-sh: update sidebar
    • pterm-sh: add override-default-printer.md
    • pterm-sh: add BigText documentation
    • pterm-sh: add documentation on how to write documentation
    • pterm-sh: change style.css
    • pterm-sh: disbale service worker
    • pterm-sh: add favicon
    • pterm-sh: fix some styling issues
    • pterm-sh: disable share buttons
    • pterm-sh: add quick-start.md
    • pterm-sh: fix link in intro
    • pterm-sh: add readme
    • pterm-sh: add review check description
    • pterm-sh: update documentation intro
    • pterm-sh: write writing-documentation.md
    • pterm-sh: add flat style to alerts
    • pterm-sh: fix coverpage link to documentation
    • pterm-sh: add writing-documentation.md
    • pterm-sh: update sidebar
    • pterm-sh: add contributing.md, intro.md and review-checks.md
    • pterm-sh: update coverpage
    • pterm-sh: change | to │
    • pterm.sh: update pterm logo
    • readme: add link to pterm documentation
    • readme: add links to pterm website

    Features

    • color each line separately when using multi line input

    Test

    • basictext: proxy print functions to DevNull
    • progressbar: proxy print functions to DevNull
    Source code(tar.gz)
    Source code(zip)
Owner
✨ A modern go module to beautify console output. Featuring charts, progressbars, tables, trees and many more 🚀 It's completely configurable and cross-platform!
null
Console Text Colors - The non-invasive cross-platform terminal color library does not need to modify the Print method

ctc - Console Text Colors The non-invasive cross-platform terminal color library does not need to modify the Print method Virtual unix-like environmen

null 34 Sep 8, 2021
Terminal string styling for go done right, with full and painless Windows 10 support.

GChalk GChalk is a library heavily inspired by chalk, the popular Node.js terminal color library, and using go ports of supports-color and ansi-styles

Jason Walton 280 Sep 12, 2021
Simple tables in terminal with Go

Simple tables in terminal with Go This package allows to generate and display ascii tables in the terminal, f.e.: +----+------------------+-----------

Alexey Popov 327 Sep 21, 2021
Minimalist Go package aimed at creating Console User Interfaces.

GOCUI - Go Console User Interface Minimalist Go package aimed at creating Console User Interfaces. Features Minimalist API. Views (the "windows" in th

Roi Martin 7.4k Sep 25, 2021
A tiny library for super simple Golang tables

Tabby A tiny library for super simple Golang tables Get Tabby go get github.com/cheynewallace/tabby Import Tabby import "github.com/cheynewallace/tabb

Cheyne Wallace 296 Sep 16, 2021
Small library for simple and convenient formatted stylized output to the console.

cfmt cfmt is a small library for simple and convenient formatted stylized output to the console, providing an interface that is exactly the same as th

Makhnev Petr 28 Sep 19, 2021
Tabular simplifies printing ASCII tables from command line utilities

tabular Tabular simplifies printing ASCII tables from command line utilities without the need to pass large sets of data to it's API. Simply define th

InVision 55 Sep 19, 2021
Change the color of console text.

go-colortext package This is a package to change the color of the text and background in the console, working both under Windows and other systems. Un

Yi Deng 207 Jul 1, 2021
Terminal based dashboard.

Termdash is a cross-platform customizable terminal based dashboard. The feature set is inspired by the gizak/termui project, which in turn was inspire

Jakub Sobon 1.8k Sep 23, 2021
Pure Go termbox implementation

IMPORTANT This library is somewhat not maintained anymore. But I'm glad that it did what I wanted the most. It moved people away from "ncurses" mindse

null 4.1k Sep 16, 2021
Intuitive package for prettifying terminal/console output. http://godoc.org/github.com/ttacon/chalk

chalk Chalk is a go package for styling console/terminal output. Check out godoc for some example usage: http://godoc.org/github.com/ttacon/chalk The

Trey Tacon 380 Sep 10, 2021
Golang terminal dashboard

termui termui is a cross-platform and fully-customizable terminal dashboard and widget library built on top of termbox-go. It is inspired by blessed-c

Zack Guo 11.3k Sep 25, 2021
A go library to improve readability in terminal apps using tabular data

uitable uitable is a go library for representing data as tables for terminal applications. It provides primitives for sizing and wrapping columns to i

Greg Osuri 618 Sep 19, 2021
Yet Another CLi Spinner; providing over 70 easy to use and customizable terminal spinners for multiple OSes

Yet Another CLi Spinner (for Go) Package yacspin provides yet another CLi spinner for Go, taking inspiration (and some utility code) from the https://

Tim Heckman 196 Sep 12, 2021
Golang ultimate ANSI-colors that supports Printf/Sprintf methods

Aurora Ultimate ANSI colors for Golang. The package supports Printf/Sprintf etc. TOC Installation Usage Simple Printf aurora.Sprintf Enable/Disable co

Konstantin Ivanov 1.1k Sep 20, 2021
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

asciigraph Go package to make lightweight ASCII line graphs ╭┈╯. Installation go get github.com/guptarohit/asciigraph Usage Basic graph package main

Rohit Gupta 1.8k Sep 20, 2021
A go library to render progress bars in terminal applications

uiprogress A Go library to render progress bars in terminal applications. It provides a set of flexible features with a customizable API. Progress bar

Greg Osuri 1.8k Sep 15, 2021
An ANSI colour terminal package for Go

colourize An ANSI colour terminal package for Go. Supports all ANSI colours and emphasis. Not compatible with Windows systems. Installation go get gi

Trey Bastian 24 Mar 30, 2021