ui

package
v0.0.0-...-ae768a3 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	STRAWBERRY_100 = Color(0xff8c82)
	STRAWBERRY_300 = Color(0xed5353)
	STRAWBERRY_500 = Color(0xc6262e)
	STRAWBERRY_700 = Color(0xa10705)
	STRAWBERRY_900 = Color(0x7a0000)

	ORANGE_100 = Color(0xffc27d)
	ORANGE_300 = Color(0xffa154)
	ORANGE_500 = Color(0xf37329)
	ORANGE_700 = Color(0xcc3b02)
	ORANGE_900 = Color(0xa62100)

	BANANA_100 = Color(0xfff394)
	BANANA_300 = Color(0xffe16b)
	BANANA_500 = Color(0xf9c440)
	BANANA_700 = Color(0xd48e15)
	BANANA_900 = Color(0xad5f00)

	LIME_100 = Color(0xd1ff82)
	LIME_300 = Color(0x9bdb4d)
	LIME_500 = Color(0x68b723)
	LIME_700 = Color(0x3a9104)
	LIME_900 = Color(0x206b00)

	MINT_100 = Color(0x89ffdd)
	MINT_300 = Color(0x43d6b5)
	MINT_500 = Color(0x28bca3)
	MINT_700 = Color(0x0e9a83)
	MINT_900 = Color(0x007367)

	BLUEBERRY_100 = Color(0x8cd5ff)
	BLUEBERRY_300 = Color(0x64baff)
	BLUEBERRY_500 = Color(0x3689e6)
	BLUEBERRY_700 = Color(0x0d52bf)
	BLUEBERRY_900 = Color(0x002e99)

	BUBBLEGUM_100 = Color(0xfe9ab8)
	BUBBLEGUM_300 = Color(0xf4679d)
	BUBBLEGUM_500 = Color(0xde3e80)
	BUBBLEGUM_700 = Color(0xbc245d)
	BUBBLEGUM_900 = Color(0x910e38)

	GRAPE_100 = Color(0xe4c6fa)
	GRAPE_300 = Color(0xcd9ef7)
	GRAPE_500 = Color(0xa56de2)
	GRAPE_700 = Color(0x7239b3)
	GRAPE_900 = Color(0x452981)

	COCOA_100 = Color(0xa3907c)
	COCOA_300 = Color(0x8a715e)
	COCOA_500 = Color(0x715344)
	COCOA_700 = Color(0x57392d)
	COCOA_900 = Color(0x3d211b)

	SILVER_100 = Color(0xfafafa)
	SILVER_300 = Color(0xd4d4d4)
	SILVER_500 = Color(0xabacae)
	SILVER_700 = Color(0x7e8087)
	SILVER_900 = Color(0x555761)

	SLATE_100 = Color(0x95a3ab)
	SLATE_300 = Color(0x667885)
	SLATE_500 = Color(0x485a6c)
	SLATE_700 = Color(0x273445)
	SLATE_900 = Color(0x0e141f)

	BLACK_100 = Color(0x666666)
	BLACK_300 = Color(0x4d4d4d)
	BLACK_500 = Color(0x333333)
	BLACK_700 = Color(0x1a1a1a)
	BLACK_900 = Color(0x000000)

	WHITE = Color(0xffffff)
)

ElementaryOS palette https://github.com/elementary/stylesheet/blob/master/src/gtk-4.0/_palette.scss

View Source
var (
	ACCENT_COLOR_100 = BLUEBERRY_100
	ACCENT_COLOR_300 = BLUEBERRY_300
	ACCENT_COLOR_500 = BLUEBERRY_500
	ACCENT_COLOR_700 = BLUEBERRY_700
	ACCENT_COLOR_900 = BLUEBERRY_900
	ACCENT_COLOR     = MixColor(BLUEBERRY_300, BLUEBERRY_500, 25)
)
View Source
var (
	BackgroundColor    = WHITE
	SecondaryTextColor = SILVER_500

	DangerColor  = STRAWBERRY_500
	SuccessColor = LIME_700
	WarningColor = BANANA_900

	InputBgColor   = SILVER_100
	ViewsBgColor   = WHITE
	SidebarBgColor = MixColor(SILVER_100, SILVER_300, 75)

	BorderColor       = MixColor(SILVER_300, WHITE, 70)
	ActiveBorderColor = SILVER_500

	CardColor     = SidebarBgColor
	CheckboxColor = ACCENT_COLOR_500
)
View Source
var (
	Flexed = layout.Flexed
	Rigid  = layout.Rigid
)
View Source
var (
	RowSpacer1 = Rigid(HSpacer1)
	RowSpacer2 = Rigid(HSpacer2)
	RowSpacer3 = Rigid(HSpacer3)
	RowSpacer4 = Rigid(HSpacer4)
	RowSpacer5 = Rigid(HSpacer5)
	RowSpacer6 = Rigid(HSpacer6)
)
View Source
var (
	ColSpacer1 = Rigid(WSpacer1)
	ColSpacer2 = Rigid(WSpacer2)
	ColSpacer3 = Rigid(WSpacer3)
	ColSpacer4 = Rigid(WSpacer4)
	ColSpacer5 = Rigid(WSpacer5)
	ColSpacer6 = Rigid(WSpacer6)
)

Insets

View Source
var (
	WSpacer1 = layout.Spacer{Width: SpaceUnit}.Layout
	WSpacer2 = layout.Spacer{Width: SpaceUnit * 2}.Layout
	WSpacer3 = layout.Spacer{Width: SpaceUnit * 3}.Layout
	WSpacer4 = layout.Spacer{Width: SpaceUnit * 4}.Layout
	WSpacer5 = layout.Spacer{Width: SpaceUnit * 5}.Layout
	WSpacer6 = layout.Spacer{Width: SpaceUnit * 6}.Layout
)

Spaces

View Source
var (
	HSpacer1 = layout.Spacer{Height: SpaceUnit}.Layout
	HSpacer2 = layout.Spacer{Height: SpaceUnit * 2}.Layout
	HSpacer3 = layout.Spacer{Height: SpaceUnit * 3}.Layout
	HSpacer4 = layout.Spacer{Height: SpaceUnit * 4}.Layout
	HSpacer5 = layout.Spacer{Height: SpaceUnit * 5}.Layout
	HSpacer6 = layout.Spacer{Height: SpaceUnit * 6}.Layout
)
View Source
var (
	SelectedTabBgColor = MixColor(ACCENT_COLOR_100, WHITE, 20)
	SelectedTabFgColor = ACCENT_COLOR_500
)
View Source
var (
	TooltipFgColor = WHITE
	TooltipBgColor = Alpha(BLACK_500, 242)
)
View Source
var AlignEnd = TextAlignment(text.End)
View Source
var AlignMiddle = TextAlignment(text.Middle)
View Source
var AlignStart = TextAlignment(text.Start)
View Source
var OneLine = MaxLines(1)
View Source
var Theme = ThemeStyle{
	FontSize:      13,
	FontFamily:    fontShaper,
	FontWeight:    font.Normal,
	TextAlignment: text.Start,
	TextColor:     BLACK_500,
	MaxLines:      0,
}
View Source
var (
	ToolbarBgColor = SILVER_100
)

Functions

func Alpha

func Alpha(c color.NRGBA, alpha uint8) color.NRGBA

func Color

func Color(hex int) color.NRGBA

func LayoutToWrapper

func LayoutToWrapper(r func(C, W) D) func(w W) W

func LineEditor

func LineEditor() widget.Editor

func Max

func Max[T Numeric](s []T) (m T)

func MixColor

func MixColor(c1, c2 color.NRGBA, percent int) color.NRGBA

Types

type C

type C = layout.Context

type Clickable

type Clickable = widget.Clickable

type ClickableList

type ClickableList struct {
	List
	Btns map[int]*Clickable
}

func NewClickableList

func NewClickableList() ClickableList

func (*ClickableList) Layout

func (l *ClickableList) Layout(len int, ele layout.ListElement, onClick func(i int)) W

type Clickables

type Clickables map[string]*Clickable

func NewClickables

func NewClickables() Clickables

func (Clickables) Get

func (c Clickables) Get(id string) *Clickable

type D

type D = layout.Dimensions

func EmptyWidget

func EmptyWidget(c C) D

type DP

type DP = unit.Dp
var (
	Pt            = f32.Pt
	SpaceUnit  DP = 8
	BorderSize DP = 1
)

type DirectoryBrowser

type DirectoryBrowser struct {
	List        List
	Btns        map[string]*Clickable
	Up          Clickable
	MinItemSize int
}

func NewDirectoryBrowser

func NewDirectoryBrowser() DirectoryBrowser

func (*DirectoryBrowser) Layout

func (d *DirectoryBrowser) Layout(dist *string) W

type FlexChild

type FlexChild = layout.FlexChild

type List

type List = layout.List

func NewVerticalList

func NewVerticalList() List

type Numeric

type Numeric interface {
	constraints.Float | constraints.Integer
}

type P

type P = image.Point

type SP

type SP = unit.Sp

type TabChild

type TabChild struct {
	Name  string
	Panel W
}

type Tabs

type Tabs struct {
	List      List
	Active    string
	Clickable map[string]*Clickable
}

func (*Tabs) Layout

func (l *Tabs) Layout(tabs ...*TabChild) W

type ThemeStyle

type ThemeStyle struct {
	FontSize      SP
	FontFamily    *text.Shaper
	FontWeight    font.Weight
	TextAlignment text.Alignment
	TextColor     color.NRGBA
	MaxLines      int
}

type W

type W = layout.Widget

func Background

func Background(background color.NRGBA, w W) W

func Border

func Border(w W) W

func BorderActive

func BorderActive(w W) W

func Button

func Button(clickable *Clickable, label string) W

func Centered

func Centered(w W) W

func Chart

func Chart[T Numeric](ds []T, height float32) W

func Checkbox

func Checkbox(btn *Clickable, value bool, onclick func()) W

func CheckboxBool

func CheckboxBool(btn *Clickable, value *bool) W

func CheckboxBtn

func CheckboxBtn(value bool, btn *Clickable) W

func Columns

func Columns(children ...layout.FlexChild) W

func ColumnsVCentered

func ColumnsVCentered(children ...layout.FlexChild) W

func Constraint

func Constraint(width, height int, w W) W

func FormRow

func FormRow(children ...layout.FlexChild) W

func Grid

func Grid(l *List, count int, minItemSize int, ele layout.ListElement) W

func HR

func HR(sz int) W

func Icon

func Icon(b []byte, color color.NRGBA) W

func Label

func Label(s string) W

func LayoutToWidget

func LayoutToWidget(r func(C, W) D, w W) W

func OnClick

func OnClick(btn *Clickable, w W, onclick func()) W

func Panel

func Panel(title string, w W) W

func RoundedCorners

func RoundedCorners(w W) W

func Rows

func Rows(children ...layout.FlexChild) W

func TabButton

func TabButton(cl *Clickable, active bool, l string) W

func Text

func Text(s string) W

func TextInput

func TextInput(editor *widget.Editor, hint string) W

func ToolbarButton

func ToolbarButton(clickable *Clickable, icon W, desc string) W

func Tooltip

func Tooltip(attachTo W, s string) W

func VR

func VR(sz int) W

func WidgetIf

func WidgetIf(cond bool, w W) W

func Wrap

func Wrap(w W, wrappers ...Wrapper) W

func ZebraList

func ZebraList(l *List, len int, ele layout.ListElement) W

type Wrapper

type Wrapper = func(W) W

func Font

func Font(f *text.Shaper) Wrapper

func FontEnlarge

func FontEnlarge(s float32) Wrapper

func FontSize

func FontSize(s SP) Wrapper

func FontWeight

func FontWeight(f font.Weight) Wrapper

func Margin

func Margin(t, r, b, l unit.Dp) Wrapper

func MaxLines

func MaxLines(i int) Wrapper

func TextAlignment

func TextAlignment(a text.Alignment) Wrapper

func TextColor

func TextColor(col color.NRGBA) Wrapper

Jump to

Keyboard shortcuts

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