tcellx

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2024 License: MIT Imports: 4 Imported by: 0

README

tcellx

extensions for tcell package

Documentation

Overview

Package tcellx provides extensions to github.com/gdamore/tcell/v2 package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorID

func ColorID(c Color) string

ColorID returns the ID string of the color that can be used to build style tags.

Types

type AdaptiveColor

type AdaptiveColor interface {
	Resolve(termcap.Provider) Color
}

AdaptiveColor represents a color that adapts to the terminal color profile.

type AdaptiveColorBuilder

type AdaptiveColorBuilder struct {
	// contains filtered or unexported fields
}

AdaptiveColorBuilder is a builder for adaptive colors.

func NewAdaptiveColor

func NewAdaptiveColor(c Color) AdaptiveColorBuilder

NewAdaptiveColor creates a new adaptive color builder.

func (AdaptiveColorBuilder) Resolve

func (c AdaptiveColorBuilder) Resolve(provider termcap.Provider) Color

func (AdaptiveColorBuilder) Result

Result returns the resulting adaptive color.

func (AdaptiveColorBuilder) WithANSI

WithANSI sets the ANSI color for both dark and light modes.

func (AdaptiveColorBuilder) WithANSI256

WithANSI256 sets the ANSI 256 color for both dark and light modes.

func (AdaptiveColorBuilder) WithLightANSI

func (b AdaptiveColorBuilder) WithLightANSI(c Color) AdaptiveColorBuilder

WithLightANSI sets the ANSI color for light mode.

func (AdaptiveColorBuilder) WithLightANSI256

func (b AdaptiveColorBuilder) WithLightANSI256(c Color) AdaptiveColorBuilder

WithLightANSI256 sets the ANSI 256 color for light mode.

func (AdaptiveColorBuilder) WithLightRGB

WithLightRGB sets the RGB color for light mode.

func (AdaptiveColorBuilder) WithRGB

WithRGB sets the RGB color for both dark and light modes.

type Color

type Color = tcell.Color

Color represents a color in the terminal.

func ANSIColor

func ANSIColor(c Color) Color

ANSIColor returns the nearest ANSI color for the given color.

func ANSIExtendedColor

func ANSIExtendedColor(c Color) Color

ANSIExtendedColor returns the nearest ANSI 256 color for the given color excluding basic 16 ANSI colors.

type Style

type Style struct {
	// contains filtered or unexported fields
}

Style represents a style in the terminal.

func (Style) Apply

func (s Style) Apply(base tcell.Style) tcell.Style

Apply applies the style to the base style.

func (Style) String

func (s Style) String() string

String returns the style as a string that can be used as a style tag.

func (Style) WithAttrs

func (s Style) WithAttrs(attrs tcell.AttrMask) Style

WithAttrs sets the attributes.

func (Style) WithBackground

func (s Style) WithBackground(c Color) Style

WithBackground sets the background color.

func (s Style) WithBlink(on bool) Style

WithBlink sets or removes the blink attribute.

func (Style) WithBold

func (s Style) WithBold(on bool) Style

WithBold sets or removes the bold attribute.

func (Style) WithDim

func (s Style) WithDim(on bool) Style

WithDim sets or removes the dim attribute.

func (Style) WithForeground

func (s Style) WithForeground(c Color) Style

WithForeground sets the foreground color.

func (Style) WithItalic

func (s Style) WithItalic(on bool) Style

WithItalic sets or removes the italic attribute.

func (Style) WithReverse

func (s Style) WithReverse(on bool) Style

WithReverse sets or removes the reverse attribute.

func (Style) WithStrikeThrough

func (s Style) WithStrikeThrough(on bool) Style

WithStrikeThrough sets or removes the strike-through attribute.

func (Style) WithURL

func (s Style) WithURL(url string) Style

WithURL sets the URL.

func (Style) WithURLID

func (s Style) WithURLID(urlID string) Style

WithURLID sets the URL ID.

func (Style) WithUnderline

func (s Style) WithUnderline(on bool) Style

WithUnderline sets or removes the underline attribute.

func (Style) WithoutAttrs

func (s Style) WithoutAttrs(attrs tcell.AttrMask) Style

WithoutAttrs removes the attributes.

Directories

Path Synopsis
Package termcap provides an interface for querying terminal capabilities.
Package termcap provides an interface for querying terminal capabilities.
termenvcap module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳