envcolor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package envcolor resolves the colour an environment is drawn in.

Six built-in hues. Well-known slugs get a fixed default (production red, staging amber, dev violet); every other static env takes the next unused hue in ladder order. Overrides, most specific wins: the env row's own colour (the config file on a managed stack, stack settings otherwise), the org's default for that slug, then these defaults.

Index

Constants

This section is empty.

Variables

View Source
var Names = []string{"teal", "sky", "lime", "amber", "rose", "violet"}

Names are the palette, in ladder order. Each is a --rw-env-<name> token in css/input.css, tuned per theme, which is why a name is stored rather than a hex: the same env reads right in light and dark.

Functions

func BySlug

func BySlug(envs []repo.Environment, org *repo.Org, managed bool) map[string]Resolved

BySlug is Map keyed by slug, for callers that hold a slug (plan rows).

func CSS

func CSS(v string) string

CSS is the value to put in a style attribute.

func Map

func Map(envs []repo.Environment, org *repo.Org, managed bool) map[string]Resolved

Map resolves every env of one stack, keyed by env id. envs is the stack's list in store order (the ladder). managed says the stack's config file owns the env rows, which only changes what Source reports.

func OrgDefaults

func OrgDefaults(org *repo.Org) map[string]string

OrgDefaults parses the org row's slug to colour map. Nil-safe.

func Valid

func Valid(v string) bool

Valid accepts a palette name or a #rrggbb value. "" is valid: it clears.

Types

type Resolved

type Resolved struct {
	Value  string // palette name or hex
	CSS    string // CSS(Value)
	Source string // file | stack | org | default
}

Resolved is one env's colour and where it came from.

func For

func For(env *repo.Environment, envs []repo.Environment, org *repo.Org, managed bool) Resolved

For resolves one env. envs must be the stack's full list.

Jump to

Keyboard shortcuts

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