chromajson

package module
v0.0.2 Latest Latest
Warning

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

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

README

chromajson

Go Reference

A JSON schema and loader for chroma.

Schema

schema.json provides a JSON schema.

Chroma themes are conventionally named <theme>.chroma.json.

Styles

There is a valid catppuccin style in catppuccin.json.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Style

type Style struct {
	Name    string                `json:"name"`
	Entries map[string]StyleEntry `json:"style"`
}

Style is a chroma style

func LoadStyle

func LoadStyle(r io.Reader) (*Style, error)

LoadStyle loads a Style from an io.Reader

func (*Style) Chroma

func (s *Style) Chroma() (*chroma.Style, error)

Chroma converts a Style to a chroma.Style

func (*Style) Register

func (s *Style) Register() error

Register registers the Style directly to chroma

type StyleEntry

type StyleEntry struct {
	Color      string   `json:"color"`
	Background string   `json:"background"`
	Border     string   `json:"border"`
	Accents    []string `json:"accent"`
}

StyleEntry is a mapping for a chroma style

func (StyleEntry) String

func (s StyleEntry) String() string

String returns a chroma-representable style entry

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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