Advanced ANSI style & color support for your terminal applications

Overview

termenv Logo
Latest Release GoDoc Build Status Coverage Status Go ReportCard

termenv lets you safely use advanced styling options on the terminal. It gathers information about the terminal environment in terms of its ANSI & color support and offers you convenient methods to colorize and style your output, without you having to deal with all kinds of weird ANSI escape sequences and color conversions.

Example output

Features

  • RGB/TrueColor support
  • Detects the supported color range of your terminal
  • Automatically converts colors to the best matching, available colors
  • Terminal theme (light/dark) detection
  • Chainable syntax
  • Nested styles

Installation

go get github.com/muesli/termenv

Query Terminal Support

termenv can query the terminal it is running in, so you can safely use advanced features, like RGB colors. ColorProfile returns the color profile supported by the terminal:

profile := termenv.ColorProfile()

This returns one of the supported color profiles:

  • termenv.Ascii - no ANSI support detected, ASCII only
  • termenv.ANSI - 16 color ANSI support
  • termenv.ANSI256 - Extended 256 color ANSI support
  • termenv.TrueColor - RGB/TrueColor support

You can also query the terminal for its color scheme, so you know whether your app is running in a light- or dark-themed environment:

// Returns terminal's foreground color
color := termenv.ForegroundColor()

// Returns terminal's background color
color := termenv.BackgroundColor()

// Returns whether terminal uses a dark-ish background
darkTheme := termenv.HasDarkBackground()

Colors

termenv supports multiple color profiles: ANSI (16 colors), ANSI Extended (256 colors), and TrueColor (24-bit RGB). Colors will automatically be degraded to the best matching available color in the desired profile:

TrueColor => ANSI 256 Colors => ANSI 16 Colors => Ascii

s := termenv.String("Hello World")

// Retrieve color profile supported by terminal
p := termenv.ColorProfile()

// Supports hex values
// Will automatically degrade colors on terminals not supporting RGB
s.Foreground(p.Color("#abcdef"))
// but also supports ANSI colors (0-255)
s.Background(p.Color("69"))
// ...or the color.Color interface
s.Foreground(p.FromColor(color.RGBA{255, 128, 0, 255}))

// Combine fore- & background colors
s.Foreground(p.Color("#ffffff")).Background(p.Color("#0000ff"))

// Supports the fmt.Stringer interface
fmt.Println(s)

Styles

You can use a chainable syntax to compose your own styles:

s := termenv.String("foobar")

// Text styles
s.Bold()
s.Faint()
s.Italic()
s.CrossOut()
s.Underline()
s.Overline()

// Reverse swaps current fore- & background colors
s.Reverse()

// Blinking text
s.Blink()

// Combine multiple options
s.Bold().Underline()

Template Helpers

// load template helpers
f := termenv.TemplateFuncs(termenv.ColorProfile())
tpl := template.New("tpl").Funcs(f)

// apply bold style in a template
bold := `{{ Bold "Hello World" }}`

// examples for colorized templates
col := `{{ Color "#ff0000" "#0000ff" "Red on Blue" }}`
fg := `{{ Foreground "#ff0000" "Red Foreground" }}`
bg := `{{ Background "#0000ff" "Blue Background" }}`

// wrap styles
wrap := `{{ Bold (Underline "Hello World") }}`

// parse and render
tpl, err = tpl.Parse(bold)

var buf bytes.Buffer
tpl.Execute(&buf, nil)
fmt.Println(&buf)

Other available helper functions are: Faint, Italic, CrossOut, Underline, Overline, Reverse, and Blink.

Screen

// Reset the terminal to its default style, removing any active styles
termenv.Reset()

// Switch to the altscreen. The former view can be restored with ExitAltScreen()
termenv.AltScreen()

// Exit the altscreen and return to the former terminal view
termenv.ExitAltScreen()

// Clear the visible portion of the terminal
termenv.ClearScreen()

// Move the cursor to a given position
termenv.MoveCursor(row, column)

// Hide the cursor
termenv.HideCursor()

// Show the cursor
termenv.ShowCursor()

// Save the cursor position
termenv.SaveCursorPosition()

// Restore a saved cursor position
termenv.RestoreCursorPosition()

// Move the cursor up a given number of lines
termenv.CursorUp(n)

// Move the cursor down a given number of lines
termenv.CursorDown(n)

// Move the cursor up a given number of lines
termenv.CursorForward(n)

// Move the cursor backwards a given number of cells
termenv.CursorBack(n)

// Move the cursor down a given number of lines and place it at the beginning
// of the line
termenv.CursorNextLine(n)

// Move the cursor up a given number of lines and place it at the beginning of
// the line
termenv.CursorPrevLine(n)

// Clear the current line
termenv.ClearLine()

// Clear a given number of lines
termenv.ClearLines(n)

// Set the scrolling region of the terminal
termenv.ChangeScrollingRegion(top, bottom)

// Insert the given number of lines at the top of the scrollable region, pushing
// lines below down
termenv.InsertLines(n)

// Delete the given number of lines, pulling any lines in the scrollable region
// below up
termenv.DeleteLines(n)

Mouse

// Enable X10 mouse mode, only button press events are sent
termenv.EnableMousePress()

// Disable X10 mouse mode
termenv.DisableMousePress()

// Enable Mouse Tracking mode
termenv.EnableMouse()

// Disable Mouse Tracking mode
termenv.DisableMouse()

// Enable Hilite Mouse Tracking mode
termenv.EnableMouseHilite()

// Disable Hilite Mouse Tracking mode
termenv.DisableMouseHilite()

// Enable Cell Motion Mouse Tracking mode
termenv.EnableMouseCellMotion()

// Disable Cell Motion Mouse Tracking mode
termenv.DisableMouseCellMotion()

// Enable All Motion Mouse mode
termenv.EnableMouseAllMotion()

// Disable All Motion Mouse mode
termenv.DisableMouseAllMotion()

Color Chart

ANSI color chart

You can find the source code used to create this chart in termenv's examples.

Related Projects

  • reflow - ANSI-aware text operations
  • Glow - a markdown renderer for the command-line, which uses termenv

License

MIT

Comments
  • Use golang.org/x/sys/unix to work around syscall differences

    Use golang.org/x/sys/unix to work around syscall differences

    This should fix #15. @tredoe could you verify?

    This also removes the assumption that the platform uses 64-bit words, which was previously encoded in the assumption that syscall.FdSet.Bits consisted of int64s.

    opened by twpayne 14
  • error in centos

    error in centos

    OS Version: CentOS Linux release 7.8.2003 (Core)

    Error encountered: [[email protected] airlock-menu]# go get github.com/muesli/termenv

    github.com/muesli/termenv

    /root/go_proj/src/src/github.com/muesli/termenv/termenv_unix.go:90:9: readfds.Set undefined (type unix.FdSet has no field or method Set) /root/go_proj/src/src/github.com/muesli/termenv/termenv_unix.go:107:13: readfds.IsSet undefined (type unix.FdSet has no field or method IsSet)

    opened by crack38 11
  • No color with version > 0.9.0

    No color with version > 0.9.0

    After upgrade to 0.12.0, I found my cli is running with no color. After seeking problems, I found termenv' version is the root casue.

    Show the code:

    git clone [email protected]:alswl/bubble-table.git
    g rev-parse HEAD
    635b501f4a8b900b93291b3841eadabf16d78295
    cat go.mod | grep termenv
            github.com/muesli/termenv v0.9.0 // indirect
    go mod tidy; go run examples/features/main.go
    
    image

    After upgrade:

    gsed -i 's/termenv v0.9.0/termenv v0.10.0/g' go.mod
    go mod tidy; go run examples/features/main.go
    
    image

    And the latest 0.12.0 still not works for me.

    My system versions:

    ➜  bubble-table git:(main) ✗ neofetch
                        'c.          ?
                     ,xNMM.          -------------------------------
                   .OMMMMo           OS: macOS 12.6 21G115 arm64
                   OMMM0,            Host: MacBookPro18,1
         .;loddo:' loolloddol;.      Kernel: 21.6.0
       cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 3 days, 1 hour, 41 mins
     .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 502 (brew)
     XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.9
    ;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1728x1117, 2560x1440
    :MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
    .MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
     kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Light)
     .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: tmux
      .XMMMMMMMMMMMMMMMMMMMMMMMMK.   CPU: Apple M1 Pro
        kMMMMMMMMMMMMMMMMMMMMMMd     GPU: Apple M1 Pro
         ;KMMMMMMMWXXWMMMMMMMk.      Memory: 5563MiB / 32768MiB
           .cooc,.    .,coo:.
    
    
    
    opened by alswl 8
  • Bold ansi codes not removed in unsupported terminals

    Bold ansi codes not removed in unsupported terminals

    https://play.golang.org/p/vV2-0Q2g-9t

    ↑ Output of this playground link:

    Test
    Test with color and bold
    Test with only color
    

    But they should be removed, right?

    enhancement 
    opened by fiws 7
  • Better Windows 10 support

    Better Windows 10 support

    I haven't tried your library on win10, so maybe you have some magic I don't know about, but I'm guessing this library works well in Windows Terminal, but not so much in cmd.com or powershell (where ANSI is disabled by default). But if I'm wrong and there's magic that makes this all work out, I'm very interested in what it is! :)

    Over in gchalk, I first of all ported node.js's "supports-color" library which detects if the current Windows version supports 256 color or 16.7m color ANSI, and second I used this trick to enable ANSI color on non-Windows-Terminal terminals if it isn't enabled already. If you're interested in a PR that steals these, or which just uses supportscolor, I'm happy to supply one.

    opened by jwalton 6
  • Unable to query back/foreground color with gnome-terminal/tilix (libvte)

    Unable to query back/foreground color with gnome-terminal/tilix (libvte)

    Hi,

    thanks for this awesome library! I've discovered that with the current code, I'm unable to query the foreground/background color in terminals using libvte, which includes gnome-terminal and tilix on Debian stable (libvte 0.54.2). It works with urxvt though.

    I've looked into the issue, building the examples/hello-world and running it with strace reveals what's happening (using tilix with a light background color, #fafafa):

    $ cd examples/hello-world
    $ go build
    $ strace -e read,write -s 999 ./hello-world
    [...]
    write(1, "\33]11;?\7", 7)               = 7
    read(1, "\33", 1)                       = 1
    read(1, "]", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, ";", 1)                         = 1
    read(1, "r", 1)                         = 1
    read(1, "g", 1)                         = 1
    read(1, "b", 1)                         = 1
    read(1, ":", 1)                         = 1
    read(1, "f", 1)                         = 1
    read(1, "a", 1)                         = 1
    read(1, "f", 1)                         = 1
    read(1, "a", 1)                         = 1
    read(1, "/", 1)                         = 1
    read(1, "f", 1)                         = 1
    read(1, "a", 1)                         = 1
    read(1, "f", 1)                         = 1
    read(1, "a", 1)                         = 1
    read(1, "/", 1)                         = 1
    read(1, "f", 1)                         = 1
    read(1, "a", 1)                         = 1
    read(1, "f", 1)                         = 1
    read(1, "a", 1)                         = 1
    read(1, "\33", 1)                       = 1
    read(1, "\\", 1)                        = 1
    write(1, "\n\t\33[1mHas dark background?\33[0m true\n", 36
    	Has dark background? true
    ) = 36
    +++ exited with 0 +++
    

    We can see here that termenv sends the query to the terminal using a BEL character as the terminator ("\33]11;?\7"). Then tilix/libvte responds with the color, terminated by ESC \, which is rejected by termenv.

    On urxvt, the response is terminated by BEL (with dark background #111111 this time):

    $ strace -e read,write -s 999 ./hello-world
    [...]
    write(1, "\33]11;?\7", 7)               = 7
    read(1, "\33", 1)                       = 1
    read(1, "]", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, ";", 1)                         = 1
    read(1, "r", 1)                         = 1
    read(1, "g", 1)                         = 1
    read(1, "b", 1)                         = 1
    read(1, ":", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "0", 1)                         = 1
    read(1, "0", 1)                         = 1
    read(1, "/", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "0", 1)                         = 1
    read(1, "0", 1)                         = 1
    read(1, "/", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "1", 1)                         = 1
    read(1, "0", 1)                         = 1
    read(1, "0", 1)                         = 1
    read(1, "\7", 1)                        = 1
    [...]
    

    It looks like a bug in libvte 0.54.4. I've also tested this on Fedora 32 using libvte 0.60.3, there it is fixed. I was also able to find a warning in the source code:

    if (seq.st() == 7 /* BEL */)
        warn("OSC terminated by BEL may be ignored; use ST (ESC \\) instead.");
    

    According to the standard I was able to find, OSC may be terminated by either BEL or ESC \ (named ST):

    Operating System Commands

    OSC Ps ; Pt BEL OSC Ps ; Pt ST

    I suspect that there are many more terminal emulators which just support ESC \ as terminator. It feels to me they all just copied code from xterm at some point...

    I can imagine solving this issue in two ways:

    • Using ESC \ instead of BEL when querying the colors, checking that the response is also terminated by ESC \.
    • Using BELfor querying the colors, but accepting BEL as well as ESC \ as the response terminator.

    If either solution would be acceptable, I'm willing to submit a PR. Please let me know! :)

    opened by fd0 6
  • Fails to build on OpenBSD

    Fails to build on OpenBSD

    Hi,

    Tried to install the github cli which depends on termenv:

    $ make
    ...
    # github.com/muesli/termenv
    ../go/pkg/mod/github.com/muesli/[email protected]/termenv_unix.go:30:12: undefined: termStatusReport
    ../go/pkg/mod/github.com/muesli/[email protected]/termenv_unix.go:52:12: undefined: termStatusReport
    
    opened by vext01 6
  • Add friendlier Windows set/restore console API

    Add friendlier Windows set/restore console API

    The existing EnableWindowsANSIConsole/RestoreWindowsConsole functions have a number of limitations:

    • They are only defined when termenv is built on Windows, and so require the user to use build tags, i.e. multiple source files, to control whether or not they are called and are not shown on https://pkg.go.dev/github.com/muesli/termenv by default.
    • They are hardcoded to set the console mode of stdout, and so fail if stdout is not a terminal, e.g. when redirecting the output to a file or when run in a Go test.

    This commit adds a EnableVirtualTerminalProcessing function with a different API (to avoid breaking backwards compatibility) that is safe to call on all platforms, takes an io.Writer as an argument (for output flexibility). See the comments in the function for more details.

    Replaces #88. Refs #86 (and this PR will probably need updating).

    enhancement 
    opened by twpayne 5
  • Reliably query terminal on high latency connections

    Reliably query terminal on high latency connections

    Queries to the terminal are sent and the response is read with a timeout of 100ms. If the latency between the program (running on a remote server) and the terminal (running on a user's workstation) is larger than 100ms, this fails and the program may be finished when the response can finally be read.

    This commit replaces the timeout-based approach. Two queries are sent to the terminal: first, the query we're interested in, but which may not be supported by the terminal. If it isn't, the terminal will silently ignore the request and not respond at all.

    Next, a cursor position query is sent. This should be supported by all terminals.

    Then a response is read without a timeout. Either the terminal responds with the cursor position, then we know it does not support the OSC query and we can abort. If an OSC response is read, we have our result and we just need to read the cursor position response and discard it.

    This approach will work regardless of latency. Since we know that the terminal will respond (at least to the cursor position request), there's no need for a timeout, so we can even remove the call to select().

    The approach can be tested on Linux by adding e.g. 200ms of artificial latency via tc and running a program on a remote host:

    tc qdisc add dev eth0 root netem delay 200ms 10ms
    

    The latency can be cleared as follows:

    tc qdisc del root dev eth0
    

    I've tested this on Linux only so far, but I'm confident it will work on macOS, too.

    This resolves https://github.com/muesli/duf/issues/84

    opened by fd0 5
  • Support copying text (OSC52) & hyperlinks (OSC8)

    Support copying text (OSC52) & hyperlinks (OSC8)

    • Add OSC52 to support copying text
    • Add OSC8 to support hyperlinks

    OSC52 needs to read $TERM to determine the terminal. This implements two interfaces, File and Environ, and uses them when creating a new Output.

    opened by aymanbagabas 4
  • Added GetCursorPosition()

    Added GetCursorPosition()

    Added GetCursorPosition which returns row, column or error for the current position of the cursor on the terminal. This is especially useful when users print unpredictable amount of output to terminal and want to clear lines but don't know how many lines have been printed.

    The function uses the sequence "\033[6n" to get cursor's position and then parses the output. The method to get the output from terminal is a bit unorthodox but it had to be because interacting with terminal and reading its output is not straightforward.

    This implementation was heavily inspired by this conversation but open to any suggestions or improvements so that getting cursor's position gets added to termenv.

    opened by mohsenari 3
  • fix: compiling js/wasm/plan9/aix failed missing method ColorProfile

    fix: compiling js/wasm/plan9/aix failed missing method ColorProfile

    fixed compiling wasm

    trying to compile the hello-world to wasm failed:

    termenv/examples/hello-world>   GOOS=js GOARCH=wasm go build -o m main.go
    ../../termenv.go:41:16: output.ColorProfile undefined (type *Output has no field or method ColorProfile)
    ../../termenv.go:97:9: o.ColorProfile undefined (type *Output has no field or method ColorProfile)
    

    also: ./main.go:10:33: undefined: termenv.EnableVirtualTerminalProcessing

    after this PR: it compiles...

    opened by mschneider82 0
  • Allow effectively overriding `isTTY` for mocking console output

    Allow effectively overriding `isTTY` for mocking console output

    In order to test CLIs it would be great if https://github.com/muesli/termenv/blob/6fd0ee9b252f2197df40ed856f49cca3ee9ea07f/termenv.go#L27 could effectively be overridden, such we could force treating Output.tty as a TTY or not. This is useful to provide a buffer such that any writes to an Output could include ANSI sequences, depending on which profile we might force. This way, if a CLI wants to test color output or maybe even varies the output based on whether it's a TTY (say, output TSV if not, or using a text/tablewriter if it is a TTY) it can force it.

    E.g.

    func Test(t *testing.T) {
     buffer := bytes.Buffer{}
      output = termenv.NewOutput(buffer, WithTTY(true), WithProfile(termenv.TrueColor))
      s := output.String("Hello, world!")
      s.Bold()
      fmt.Println(s);
      want := "\x1b[1mHello, world!\x1b[m"
      if got := buffer.String(); got != want  {
        t.Fatal("want %q; got %q", want, got)
      }
    }
    
    opened by heaths 0
  • feat(mouse): add extended mouse sequences

    feat(mouse): add extended mouse sequences

    Add SGR and SGR-Pixels mouse support. Other modes are discouraged to use. UTF-8 only works for UTF-8 locales and there is no way to distinguish between previous mouse modes (< 1005). URxvt on the other hand only works in URxvt. Although some terminals support this protocol, they all support the newer SGR protocol.

    SGR & SGR-Pixels modes must be enabled with basic terminal modes like cell motion (1002) and all motion (1003).

    Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Extended-coordinates Reference: http://midnight-commander.org/ticket/2662 Reference: https://github.com/xtermjs/xterm.js/issues/1962 Reference: https://gitlab.gnome.org/GNOME/vte/-/issues/155 Reference: https://bugs.gentoo.org/761787

    opened by aymanbagabas 0
  • Support/explain how to disable initial TTY read for automated testing

    Support/explain how to disable initial TTY read for automated testing

    In the context of https://github.com/cockroachdb/cockroach/pull/86457 I found that our unit tests using Expect were getting confused by the initial termenv read.

    We need to disable that somehow.

    @muesli taught me privately about the special env var CI but this needs to be documented/extended into a fully fledged feature.

    opened by knz 0
  • Add support for mintty

    Add support for mintty

    Can support for mintty be added?

    This is default terminal emulator used by MSYS2.

    Its currently failing with:

    failed to get console mode for stdout: The handle is invalid.
    failed to get console mode for stderr: The handle is invalid.
    
    bug 
    opened by rgl 0
Releases(v0.13.0)
  • v0.13.0(Sep 23, 2022)

    What's Changed

    • Add termenv.Output by @muesli in https://github.com/muesli/termenv/pull/86
    • Properly support tmux in termStatusReport by @knz in https://github.com/muesli/termenv/pull/85
    • Bracketed paste sequences by @knz in https://github.com/muesli/termenv/pull/84
    • Add friendlier Windows set/restore console API by @twpayne in https://github.com/muesli/termenv/pull/89
    • Remove styles in Ascii mode by @justenwalker in https://github.com/muesli/termenv/pull/14
    • Conveniently access an Output's template func map by @muesli in https://github.com/muesli/termenv/pull/95

    New Contributors

    • @knz made their first contribution in https://github.com/muesli/termenv/pull/85

    Full Changelog: https://github.com/muesli/termenv/compare/v0.12.0...v0.13.0

    Source code(tar.gz)
    Source code(zip)
  • v0.12.0(Jun 2, 2022)

    What's Changed

    • Add Windows color support detection by @muesli in https://github.com/muesli/termenv/pull/65
    • Don't use OSC queries if we're not in control of the terminal by @muesli in https://github.com/muesli/termenv/pull/66
    • Fix DisableMousePress doing the opposite by @muesli in https://github.com/muesli/termenv/pull/67
    • screen sessions should always support ANSI256 by @muesli in https://github.com/muesli/termenv/pull/68
    • Support foreground detection on Solaris/illumos by @muesli in https://github.com/muesli/termenv/pull/73
    • feat: update x/sys by @caarlos0 in https://github.com/muesli/termenv/pull/74
    • fix: shims for AIX and Plan9 by @muesli in https://github.com/muesli/termenv/pull/76

    New Contributors

    • @caarlos0 made their first contribution in https://github.com/muesli/termenv/pull/74

    Full Changelog: https://github.com/muesli/termenv/compare/v0.11.0...v0.12.0

    Source code(tar.gz)
    Source code(zip)
  • v0.11.0(Jan 31, 2022)

    What's Changed

    • Add session commands by @muesli in https://github.com/muesli/termenv/pull/53
    • Add terminal compatibility list to README by @muesli in https://github.com/muesli/termenv/pull/54
    • Correctly parse COLORFGBG with three values by @muesli in https://github.com/muesli/termenv/pull/56
    • Add 'kitty' and 'ansi' values as a fallback color support detection by @muesli in https://github.com/muesli/termenv/pull/58
    • Proceed with defaults if no OSC response arrives within 5 seconds by @muesli in https://github.com/muesli/termenv/pull/57
    • Add separate sets of hard- and soft-enforced linters by @muesli in https://github.com/muesli/termenv/pull/60
    • Add helper to enable virtual terminal processing on Windows by @muesli in https://github.com/muesli/termenv/pull/61
    • Bump go-isatty and x/sys by @muesli in https://github.com/muesli/termenv/pull/62
    • Use 4-bit ANSI profile for Linux console

    Full Changelog: https://github.com/muesli/termenv/compare/v0.10.0...v0.11.0

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0(Jan 28, 2022)

    What's Changed

    • Implement the Stringer interface for ANSI color types by @tarrsalah in https://github.com/muesli/termenv/pull/48
    • Add shim for GOOS js by @paralin in https://github.com/muesli/termenv/pull/51
    • Don't run OSC queries on CI by @muesli in https://github.com/muesli/termenv/pull/52

    New Contributors

    • @tarrsalah made their first contribution in https://github.com/muesli/termenv/pull/48
    • @paralin made their first contribution in https://github.com/muesli/termenv/pull/51

    Full Changelog: https://github.com/muesli/termenv/compare/v0.9.0...v0.10.0

    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Jun 24, 2021)

  • v0.8.1(Apr 2, 2021)

  • v0.8.0(Mar 11, 2021)

    Fixed:

    • Reliably query terminal on high latency connections (#27)
    • Detect screen/tmux sessions (#28)
    • Fix TemplateFuncs example (#22)

    Added:

    • Add Profile.FromColor to convert a color.Color interface to a termenv Color (#24)
    Source code(tar.gz)
    Source code(zip)
  • v0.7.4(Oct 10, 2020)

  • v0.7.3(Oct 9, 2020)

  • v0.7.2(Aug 22, 2020)

    Fixed:

    • Fix storing/restoring term state on Linux

    Added:

    • EnvNoColor: returns whether the environment variables explicitly disable color output
    • EnvColorProfile: returns the color profile based on environment variables set
    Source code(tar.gz)
    Source code(zip)
  • v0.7.1(Aug 17, 2020)

  • v0.7.0(Jul 24, 2020)

  • v0.6.0(Jul 19, 2020)

    Changes:

    • Optimize ClearLines by reducing it to a single print statement

    Added:

    • Add function for setting terminal scrolling region (aka CSR)
    • Implement cursor back/forward functions
    • Add sequences and functions for saving and restoring the cursor
    • Add sequences and functions for line insertion and deletion
    • Add mouse sequences and functions (#8)
    • Add Style.Width, which returns the width of printable runes

    Fixed:

    • Fix missing color conversion in ansi256ToANSIColor
    Source code(tar.gz)
    Source code(zip)
  • v0.5.2(Apr 30, 2020)

  • v0.5.1(Apr 29, 2020)

  • v0.5.0(Mar 31, 2020)

    Added:

    • Screen/cursor control methods

    Fixed:

    • Reading status reports with variable length and corrupt termination
    • nil pointer panic when user passes the empty string as a color value
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Jan 30, 2020)

  • v0.3.0(Jan 28, 2020)

  • v0.2.0(Jan 23, 2020)

  • v0.1.0(Jan 23, 2020)

Owner
Christian Muehlhaeuser
Geek, Gopher, Software Developer, Maker, Opensource Advocate, Tech Enthusiast, Photographer, Board and Card Gamer
Christian Muehlhaeuser
Draw images in your ANSI terminal with true color

___ _____ ____ / _ \/ _/ |/_/ /____ ______ _ Made with love by Eliuk Blau / ___// /_> </ __/ -_) __/ ' \ https://github.com/eliukblau/pix

Eliuk Blau 896 Nov 26, 2022
A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number)

go-c2dmc A Go package for converting RGB and other color formats/colorspaces into DMC thread colors (DMC color name and floss number). Implemented as

null 6 Jul 25, 2022
Generate ANSI-/Ascii-art version images/Gifs in your terminal.

ANSI-Art NOTE: This toy project is not yet finished. ANSI-version Logo Block ANSI-version Logo ASCII-version Logo Support Platform You are kindly remi

Weiran Huang 46 Nov 19, 2022
Extensible Go terminal spinner with advanced functions with 82 built-in spinners

Features Start/Stop Customizable character sets (spinners) Custom spinner color, background Custom spinner text Restarting and reversing the spinner P

Anish De 15 Aug 19, 2022
A Go library for terminal background color detection

go-termbg A Go library for terminal background color detection. The detected color is provided by RGB or theme ( dark or light ). Based on https://git

Anders Björklund 1 Jan 4, 2022
Style definitions for nice terminal layouts 👄

Lip Gloss Style definitions for nice terminal layouts. Built with TUIs in mind. Lip Gloss takes an expressive, declarative approach to terminal render

Charm 5.3k Nov 25, 2022
Small, fast library to create ANSI colored strings and codes. [go, golang]

ansi Package ansi is a small, fast library to create ANSI colored strings and codes. Install Get it go get -u github.com/mgutz/ansi Example import "gi

Mario Gutierrez 376 Nov 15, 2022
GitHub CLI extension to preview your markdown similar to the style of GitHub.

gh markdown-preview GitHub CLI extension to preview your markdown similar to the style of GitHub gh markdown-preview is a GitHub CLI extension to prev

Yusuke Wada 166 Nov 22, 2022
Advanced WSL launcher / installer. (Win10 FCU x64/arm64 or later.)

wsldl Advanced WSL Distribution Launcher / Installer Detailed documentation is here ?? Requirements Windows 10 1709 Fall Creators Update or later(x64/

yuk7 1.3k Nov 24, 2022
A simple logging interface that supports cross-platform color and concurrency.

WLog Package wlog creates simple to use UI structure. The UI is used to simply print to the screen. There a wrappers that will wrap each other to crea

Will Dixon 59 Sep 26, 2022
Color package for Go (golang)

color Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang). It has support for Windows too! The API can be used in severa

Fatih Arslan 5.8k Nov 21, 2022
Color quantization experiment for golang

bitcrush Color quantization experiment, version 4 Build git clone https://github

Sapphire Cat 0 Jun 15, 2022
A UI library for terminal applications.

tui: Terminal UI for Go A UI library for terminal applications. tui (pronounced tooey) provides a higher-level programming model for building rich ter

Marcus Olsson 2.1k Nov 20, 2022
Dinogo is an CLI framework for build terminal and shell applications in Go.

dinogo Dinogo is an CLI framework for build terminal and shell applications in Go. Features Cross Platform Fast and efficient Keyboard API Enable/Disa

Mertcan Davulcu 10 Aug 29, 2022
Source code of a YouTube tutorial about writing terminal applications with Golang

Bubble Tea Demo 00 Source code of a YouTube tutorial about writing terminal applications with Golang by using Bubble Tea. Contains a simple counter ap

Nicolás Parada 5 Nov 10, 2022
Pi-fetch - get a summary of your pi-hole stats from your terminal

pi-fetch get a summary of your pi-hole stats from your terminal _ ___ _ _ ___|_|___| _|___| |_ ___| |_ | . | |___| _| -_| _

wise 0 Jan 9, 2022
Terminal chat with multiroom support over custom protocol.

Terminal Chat Content Content Overview Download Commands Protocol Room URL Platforms Examples Overview It is a multiroom terminal chat. It allows comm

Sergey Kuznetsov 9 Sep 3, 2022
Terminal user interface for nyaa.si with support of peerflix

nyaa-cli Terminal user interface for nyaa.si with support of peerflix. Peerflix can be enabled with the --peerflix flag. By default the tool will only

Nathanael Demacon 7 Jun 25, 2022
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal.

Stonks is a terminal based stock visualizer and tracker. Installation Requirements: golang >= 1.13 Manual Clone the repo Run make && make install Pack

Eric Moynihan 516 Nov 16, 2022