style

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MutateNone

func MutateNone(styles *Styles)

Types

type Align

type Align struct {
	HAlign `style:"h-align"`
	VAlign `style:"v-align"`
}

type Border

type Border struct {
	Left   int
	Top    int
	Right  int
	Bottom int
}

func (*Border) UnmarshalStyle

func (b *Border) UnmarshalStyle(v string) error

type Box

type Box struct {
	Border  Border  `style:"border"`
	Padding Padding `style:"padding"`
	Margin  Margin  `style:"margin"`
}

type Class

type Class struct {
	Name string

	Selectors map[string]Selector
	// contains filtered or unexported fields
}

func (Class) Mutate

func (c Class) Mutate(styles *Styles)

func (Class) MutateWithSelector

func (c Class) MutateWithSelector(sel string, styles *Styles)

type Classes

type Classes map[string]Class

func DecodeClasses

func DecodeClasses(r io.Reader) (Classes, error)

func (Classes) Mutate

func (cs Classes) Mutate(styles *Styles, useClasses ...string)

func (Classes) MutateWithSelector

func (cs Classes) MutateWithSelector(sel string, styles *Styles, useClasses ...string)

type Color

type Color struct {
	Foreground RGB `style:"color"`
	Text       RGB `style:"text-color"`
	Background RGB `style:"background-color"`
}

type Dimension

type Dimension struct {
	Width       float64 `style:"width"`
	Height      float64 `style:"height"`
	LineSpacing float64 `style:"line-spacing"`
	OffsetX     float64 `style:"offset-x"`
	OffsetY     float64 `style:"offset-y"`
}

type Draw

type Draw struct {
	LineWidth float64 `style:"line-width"`
}

type Font

type Font struct {
	Family     string         `style:"font-family"`
	PointSize  float64        `style:"font-point-size"`
	Style      FontStyle      `style:"font-style"`
	Weight     FontWeight     `style:"font-weight"`
	Decoration FontDecoration `style:"font-decoration"`
}

type FontDecoration

type FontDecoration string
const (
	FontDecorationNormal    FontDecoration = "normal"
	FontDecorationUnderline FontDecoration = "underline"
)

type FontStyle

type FontStyle string
const (
	FontStyleNormal FontStyle = "normal"
	FontStyleItalic FontStyle = "italic"
)

type FontWeight

type FontWeight string
const (
	FontWeightNormal FontWeight = "normal"
	FontWeightBold   FontWeight = "bold"
)

type HAlign

type HAlign string
const (
	HAlignLeft   HAlign = "left"
	HAlignRight  HAlign = "right"
	HAlignCenter HAlign = "center"
	HAlignBlock  HAlign = "block"
)

type Margin

type Margin struct {
	Left   float64
	Top    float64
	Right  float64
	Bottom float64
}

func (*Margin) UnmarshalStyle

func (b *Margin) UnmarshalStyle(v string) error

type MutateFnc

type MutateFnc func(styles *Styles)

type Mutator

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

func DecodeMutator

func DecodeMutator(r io.Reader) (*Mutator, error)

func (*Mutator) Append

func (m *Mutator) Append(other *Mutator)

func (*Mutator) Mutate

func (m *Mutator) Mutate(styles *Styles)

type Padding

type Padding struct {
	Left   float64
	Top    float64
	Right  float64
	Bottom float64
}

func (*Padding) UnmarshalStyle

func (b *Padding) UnmarshalStyle(v string) error

type RGB

type RGB struct {
	R, G, B int
}
var Black RGB = RGB{0, 0, 0}
var White RGB = RGB{255, 255, 255}

func (RGB) String

func (c RGB) String() string

func (*RGB) UnmarshalStyle

func (c *RGB) UnmarshalStyle(s string) error

func (RGB) Values

func (c RGB) Values() (r, g, b int)

type Selector

type Selector struct {
	Name string
	// contains filtered or unexported fields
}

type Styles

type Styles struct {
	Font
	Box
	Dimension
	Table
	Align
	Color
	Draw
}

type Table

type Table struct {
	ColumnWidth float64 `style:"column-width"`
}

type Unmarshaler

type Unmarshaler interface {
	UnmarshalStyle(v string) error
}

type VAlign

type VAlign string
const (
	VAlignTop    VAlign = "top"
	VAlignMiddle VAlign = "middle"
	VAlignBottom VAlign = "bottom"
)

Jump to

Keyboard shortcuts

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