theme

package
v0.9.27 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Index

Constants

View Source
const KeyNew = "new"

Variables

View Source
var ThemeDefault = func() *Theme {
	nbl := "#72a0c1"
	if o := util.GetEnv("app_nav_color_light"); o != "" {
		nbl = o
	}
	nbd := "#00415d"
	if o := util.GetEnv("app_nav_color_dark"); o != "" {
		nbd = o
	}

	return &Theme{
		Key: "default",
		Light: &Colors{
			Border: "1px solid #dddddd", LinkDecoration: "none",
			Foreground: "#000000", ForegroundMuted: "#777777",
			Background: "#ffffff", BackgroundMuted: "#e3ebf2",
			LinkForeground: "#455d6f", LinkVisitedForeground: "#303e4a",
			NavForeground: "#000000", NavBackground: nbl,
			MenuForeground: "#000000", MenuBackground: "#acc5da", MenuSelectedBackground: "#72a0c1", MenuSelectedForeground: "#000000",
			ModalBackdrop: "rgba(77, 77, 77, .7)", Success: "#008000", Error: "#ff0000",
		},
		Dark: &Colors{
			Border: "1px solid #666666", LinkDecoration: "none",
			Foreground: "#ffffff", ForegroundMuted: "#777777",
			Background: "#121212", BackgroundMuted: "#0f1e28",
			LinkForeground: "#6f889b", LinkVisitedForeground: "#9eaebb",
			NavForeground: "#ffffff", NavBackground: nbd,
			MenuForeground: "#eeeeee", MenuBackground: "#0e2939", MenuSelectedBackground: "#00415d", MenuSelectedForeground: "#ffffff",
			ModalBackdrop: "rgba(33, 33, 33, .7)", Success: "#008000", Error: "#ff0000",
		},
	}
}()

Functions

This section is empty.

Types

type Colors

type Colors struct {
	Border         string `json:"brd"`
	LinkDecoration string `json:"ld"`

	Foreground      string `json:"fg"`
	ForegroundMuted string `json:"fgm"`
	Background      string `json:"bg"`
	BackgroundMuted string `json:"bgm"`

	LinkForeground        string `json:"lf"`
	LinkVisitedForeground string `json:"lvf"`

	NavForeground string `json:"nf"`
	NavBackground string `json:"nb"`

	MenuForeground         string `json:"mf"`
	MenuBackground         string `json:"mb"`
	MenuSelectedForeground string `json:"msf"`
	MenuSelectedBackground string `json:"msb"`

	ModalBackdrop string `json:"mbd"`
	Success       string `json:"ok"`
	Error         string `json:"err"`
}

func (*Colors) ApplyMap

func (c *Colors) ApplyMap(m util.ValueMap, prefix string) *Colors

func (*Colors) CSS

func (c *Colors) CSS(key string, indent int) string

func (*Colors) Clone

func (c *Colors) Clone() *Colors

func (*Colors) Equals

func (c *Colors) Equals(x *Colors) bool

type Service

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

func NewService

func NewService(files filesystem.FileLoader) *Service

func (*Service) All

func (s *Service) All(logger util.Logger) Themes

func (*Service) Clear

func (s *Service) Clear()

func (*Service) Get

func (s *Service) Get(theme string, logger util.Logger) *Theme

func (*Service) Save

func (s *Service) Save(t *Theme, logger util.Logger) error

type Theme

type Theme struct {
	Key   string  `json:"-"`
	Light *Colors `json:"light"`
	Dark  *Colors `json:"dark"`
	// contains filtered or unexported fields
}

func ApplyMap

func ApplyMap(frm util.ValueMap) *Theme

func ColorTheme

func ColorTheme(name string, c color.Color) *Theme

func PaletteTheme

func PaletteTheme(pal string, key string) (*Theme, error)

func (*Theme) CSS

func (t *Theme) CSS(indent int) string

func (*Theme) Clone

func (t *Theme) Clone(key string) *Theme

func (*Theme) Equals

func (t *Theme) Equals(x *Theme) bool

type Themes

type Themes []*Theme

func PaletteRandomThemes

func PaletteRandomThemes(pal string, num int) (Themes, error)

func PaletteThemes

func PaletteThemes(pal string) (Themes, error)

func (Themes) Replace

func (t Themes) Replace(n *Theme) Themes

func (Themes) Sort

func (t Themes) Sort()

Jump to

Keyboard shortcuts

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