Documentation
¶
Overview ¶
Package theme holds SSHYard's design tokens: the brand color, the light and dark palettes of the interface and of the terminal, and how a mode (auto, light, dark) chooses between them.
Index ¶
- Constants
- Variables
- func Contrast(a, b ui.Color) float64
- func Luminance(c ui.Color) float64
- func Space(n float32) float32
- type Mode
- type Shadow
- type Terminal
- type Tokens
- func (t Tokens) Apply(base ui.Theme) *ui.Theme
- func (t Tokens) Material(base ui.Theme) *ui.Theme
- func (t Tokens) SidebarTheme(base ui.Theme, clear bool) *ui.Theme
- func (t Tokens) Tint(name string) ui.Color
- func (t Tokens) TintAt(i int) ui.Color
- func (t Tokens) TintNamed(name string) (c ui.Color, ok bool)
Constants ¶
const ( RadiusSmall float32 = 6 // icon buttons, menu items, chips RadiusControl float32 = 8 // inputs, list rows, selects, banners RadiusCard float32 = 12 // panes, settings groups, popovers RadiusSheet float32 = 16 // dialogs and sheets Capsule float32 = 999 // pill buttons, segmented tracks )
Radii are the corner radii, small to large. Shapes nest concentrically: a shape inside another with padding p has the outer radius minus p.
const ( Caption float32 = 11 // details, counts, secondary lines Footnote float32 = 12 // pane headers, banners Body float32 = 13 // everything else Title3 float32 = 15 // the sidebar's app name, page headers Title2 float32 = 17 // dialog titles Title1 float32 = 22 // the settings page title, the welcome )
The type scale, in DIPs, after Apple's text styles on the Mac.
const BrandHex = "#1984FC"
BrandHex is SSHYard's fixed brand color.
const SpaceUnit float32 = 4
SpaceUnit is the step of the spacing scale: Space(n) is n steps.
Variables ¶
var Brand = ui.Hex(BrandHex)
Brand is the brand color.
var Modes = []Mode{Auto, Light, Dark}
Modes lists the modes in the order the settings show them.
var TintNames = []string{"green", "orange", "teal", "purple", "indigo", "pink", "red", "blue"}
TintNames name the Tints, in order: what a host saves as its color.
var Tints = [][2]ui.Color{ {ui.Hex("#28B14C"), ui.Hex("#30D158")}, {ui.Hex("#F59100"), ui.Hex("#FF9F0A")}, {ui.Hex("#14A3BE"), ui.Hex("#40C8E0")}, {ui.Hex("#AF52DE"), ui.Hex("#BF5AF2")}, {ui.Hex("#5856D6"), ui.Hex("#5E5CE6")}, {ui.Hex("#FF2D55"), ui.Hex("#FF375F")}, {ui.Hex("#FF3B30"), ui.Hex("#FF453A")}, {ui.Hex("#007AFF"), ui.Hex("#0A84FF")}, }
Tints are Apple's system colors, light then dark, for the tiles that tell hosts apart; the brand blue stays the accent.
Functions ¶
Types ¶
type Mode ¶
type Mode string
Mode is the appearance the user chose.
type Terminal ¶
type Terminal struct {
Foreground, Background, Cursor, CursorText, Selection, Match, MatchCurrent ui.Color
// ANSI are the 16 colors of SGR 30–37 and 90–97.
ANSI [16]ui.Color
}
Terminal is the palette of the terminal view.
type Tokens ¶
type Tokens struct {
Dark bool
Background, Surface, SurfaceHover ui.Color
SurfacePressed, Border, Text, TextMuted ui.Color
Accent, AccentHover, AccentPressed ui.Color
AccentText, Danger, Warning, Success ui.Color
Selection, Focus, Sidebar, TabActive ui.Color
Inverse, InverseText, Scrollbar ui.Color
Radius, Spacing, FontSize, ScrollbarWidth float32
// Canvas is the content area behind the panes, beside the sidebar.
Canvas ui.Color
// Inset is the fill of what sits on the canvas: panes, cards, the
// selected tab, menus.
Inset ui.Color
// Glass is the translucent fill of the toolbar and of the controls
// floating on content; GlassEdge is its hairline.
Glass, GlassEdge ui.Color
// Line is a hairline separator; Hover and Press tint a control under
// the pointer and pressed, over any fill.
Line, Hover, Press ui.Color
// Fill is the quiet fill of capsule controls at rest.
Fill ui.Color
// Card is the shadow of a card on the canvas, Lift that of a sheet
// or popover floating over the window.
Card, Lift Shadow
Terminal Terminal
}
Tokens are the colors and metrics of one appearance.
func (Tokens) Apply ¶
Apply writes the tokens over a copy of base, the theme MyGo made, and returns it, for Context.SetTheme.
func (Tokens) Material ¶
Material is the theme for content drawn on the window's material (vibrancy), whose own fill must stay clear for the material to show.
func (Tokens) SidebarTheme ¶
SidebarTheme returns the theme of the sidebar: rounded rows, a quiet hover and an unfocused selection in gray, on the sidebar's own fill (or the clear material, when clear).