theme

package
v0.0.0-...-bbcbdef Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Unlicense Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = Theme{
	Rainbow: DefaultRainbow,
	Constructs: ConstructHighlights{
		Bad: Highlight{
			Foreground: Color{
				R: 0.3,
				G: 0,
				B: 0,
				A: 1,
			},
			Background: Color{
				R: 0.9,
				G: 0,
				B: 0.2,
				A: 1,
			},
		},
		Ident: Highlight{Foreground: Color{
			R: 0.9,
			G: 0.9,
			B: 0.9,
			A: 1,
		}},
		Builtin: Highlight{Foreground: Color{
			R: 0.9,
			G: 0.3,
			B: 0,
			A: 1,
		}},
		Nil: Highlight{Foreground: Color{
			R: 1,
			G: 0.2,
			B: 0.2,
			A: 1,
		}},
		Keyword: Highlight{Foreground: Color{
			R: 0,
			G: 0.6,
			B: 0.8,
			A: 1,
		}},
		Func: Highlight{Foreground: Color{
			R: 0.3,
			G: 0.6,
			B: 0,
			A: 1,
		}},
		Type: Highlight{Foreground: Color{
			R: 0.3,
			G: 0.6,
			B: 0.3,
			A: 1,
		}},
		String: Highlight{Foreground: Color{
			R: 0,
			G: 0.8,
			B: 0,
			A: 1,
		}},
		Num: Highlight{Foreground: Color{
			R: 0.6,
			G: 0,
			B: 0.1,
			A: 1,
		}},
		Comment: Highlight{Foreground: Color{
			R: 0.6,
			G: 0.6,
			B: 0.6,
			A: 1.0,
		}},
	},
}
View Source
var (
	DefaultRainbow = Rainbow{
		Range: HighlightRange{
			Min: Highlight{
				Foreground: Color{
					R: 0.3,
					G: 0.3,
					B: 0.3,
					A: 1,
				},
			},
			Max: Highlight{
				Foreground: Color{
					R: 0.7,
					G: 0.7,
					B: 0.7,
					A: 1,
				},
			},
		},
		Available: []Highlight{
			{
				Foreground: Color{
					R: 0.7,
					G: 0.3,
					B: 0.3,
					A: 1,
				},
			},
			{
				Foreground: Color{
					R: 0.3,
					G: 0.7,
					B: 0.3,
					A: 1,
				},
			},
			{
				Foreground: Color{
					R: 0.3,
					G: 0.3,
					B: 0.7,
					A: 1,
				},
			},
			{
				Foreground: Color{
					R: 0.7,
					G: 0.7,
					B: 0.3,
					A: 1,
				},
			},
			{
				Foreground: Color{
					R: 0.7,
					G: 0.3,
					B: 0.7,
					A: 1,
				},
			},
			{
				Foreground: Color{
					R: 0.3,
					G: 0.7,
					B: 0.7,
					A: 1,
				},
			},
		},
	}
)

Functions

This section is empty.

Types

type Color

type Color struct {
	R, G, B, A float32
}

type ConstructHighlights

type ConstructHighlights map[LanguageConstruct]Highlight

type Highlight

type Highlight struct {
	Foreground, Background Color
}

type HighlightRange

type HighlightRange struct {
	Min, Max Highlight
}

func (HighlightRange) New

func (c HighlightRange) New() Highlight

type LanguageConstruct

type LanguageConstruct int
const (
	Keyword LanguageConstruct = 1 + iota
	Builtin
	Func
	Type
	Ident

	String
	Num
	Nil

	Comment

	Bad

	// ScopePair is a much higher value to provide extra space
	// for other language constructs (e.g. for languages that
	// have constructs that Go doesn't).  Because ScopePairs are
	// often intentionally highlighted with rainbow so that each
	// pair of opening/closing marks are a different color,
	// ScopePair can be used as an initial value, with the value
	// being incremented for each nested pair.
	//
	// For example, the opening/closing marks for functions may
	// be ScopePair, while opening/closing marks for if statements
	// at the top level of functions may be ScopePair+1.
	ScopePair LanguageConstruct = 100
)

type Rainbow

type Rainbow struct {
	Range     HighlightRange
	Available []Highlight
	// contains filtered or unexported fields
}

func (*Rainbow) Next

func (r *Rainbow) Next() Highlight

func (*Rainbow) Reset

func (r *Rainbow) Reset()

type Theme

type Theme struct {
	Constructs ConstructHighlights

	// Rainbow is used to highlight any LanguageConstruct values
	// that are not in the Theme's Constructs map.  If you want
	// to guarantee rainbow parens in your syntax highlighting
	// plugin, use the ScopePair LanguageConstruct as your starting
	// value and increment for nested scopes.
	//
	// See the gosyntax plugin for an example.
	Rainbow Rainbow
}

Jump to

Keyboard shortcuts

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