chalk

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 1 Imported by: 0

README

Chalk

Package chalk https://github.com/ttacon/chalk Copyright (c) 2014 Trey Tacon The MIT License (MIT)

Examples

image-20210902231614451

image-20210902231634115

  • 추가 사항

    BrightBlack   = BrightColor{Black}
    BrightRed     = BrightColor{Red}
    BrightGreen   = BrightColor{Green}
    BrightYellow  = BrightColor{Yellow}
    BrightBlue    = BrightColor{Blue}
    BrightMagenta = BrightColor{Magenta}
    BrightCyan    = BrightColor{Cyan}
    BrightWhite   = BrightColor{White}
    
  • 변경 사항

    • Color 함수를 Color 클래스와 겹칠 우려가 있어 Set으로 변경하였다
    func (c Color) Set(value string) string {
    	return fmt.Sprintf("%s%s%s", c, value, ResetColor)
    
    func (bc BrightColor) Set(value string) string {
    	return fmt.Sprintf("%s%s%s", bc, value, ResetColor)
    }
    

Documentation

Overview

Package chalk 는 터미널 및 콘솔 출력을 꾸며주는 패키지로 ttacon/chalk 패키지를 기반으로 제작되었습니다.

Index

Constants

This section is empty.

Variables

View Source
var (
	Black      = Color{0}
	Red        = Color{1}
	Green      = Color{2}
	Yellow     = Color{3}
	Blue       = Color{4}
	Magenta    = Color{5}
	Cyan       = Color{6}
	White      = Color{7}
	ResetColor = Color{9}

	BrightBlack   = BrightColor{Black}
	BrightRed     = BrightColor{Red}
	BrightGreen   = BrightColor{Green}
	BrightYellow  = BrightColor{Yellow}
	BrightBlue    = BrightColor{Blue}
	BrightMagenta = BrightColor{Magenta}
	BrightCyan    = BrightColor{Cyan}
	BrightWhite   = BrightColor{White}

	Bold          = TextStyle{1, 22}
	Dim           = TextStyle{2, 22}
	Italic        = TextStyle{3, 23}
	Underline     = TextStyle{4, 24}
	Inverse       = TextStyle{7, 27}
	Hidden        = TextStyle{8, 28}
	Strikethrough = TextStyle{9, 29}

	Reset = &style{
		foreground: ResetColor,
		background: ResetColor,
	}
)

글자색, 모양(굵게, 이탤릭, 흐릿하게 ...)을 나타내는 변수입니다.

Functions

This section is empty.

Types

type BrightColor

type BrightColor struct {
	Color
}

BrightColor 는 Color 구조체를 embedding 하며 밝은 색을 나타냅니다.

func (BrightColor) String

func (bc BrightColor) String() string

String 함수는 값에 90을 더해 밝을 색을 표현합니다.

type Color

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

Color 는 기본적으로 제공되는 색을 나타냅니다.

func (Color) NewStyle

func (c Color) NewStyle() Style

NewStyle 은 새로운 스타일을 만들어 냅니다. ex) chalk.BrightRed.NewStyle().WithBackground(chalk.White)

func (Color) Set

func (c Color) Set(value string) string

Set 은 문자열의 해당 색으로 변경하는데 사용됩니다.

func (Color) String

func (c Color) String() string

String 함수는 값에 30을 더해 밝을 색을 표현합니다.

func (Color) Value

func (c Color) Value() int

type Style

type Style interface {
	Foreground(Color)
	Background(Color)
	Style(string) string
	WithBackground(Color) Style
	WithForeground(Color) Style
	WithTextStyle(TextStyle) Style
	String() string
}

type TextStyle

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

TextStyle 은 굵게, 흐리게, 기울임꼴, 밑줄, 반전, 숨김 또는 취소선을 설정합니다

func (TextStyle) NewStyle

func (ts TextStyle) NewStyle() Style

func (TextStyle) String

func (ts TextStyle) String() string

func (TextStyle) TextStyle

func (ts TextStyle) TextStyle(value string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL