Documentation
¶
Index ¶
- Variables
- func Alpha(c color.NRGBA, alpha uint8) color.NRGBA
- func Color(hex int) color.NRGBA
- func LayoutToWrapper(r func(C, W) D) func(w W) W
- func LineEditor() widget.Editor
- func Max[T Numeric](s []T) (m T)
- func MixColor(c1, c2 color.NRGBA, percent int) color.NRGBA
- type C
- type Clickable
- type ClickableList
- type D
- type DP
- type DirectoryBrowser
- type FlexChild
- type List
- type Numeric
- type P
- type SP
- type TabChild
- type Tabs
- type ThemeStyle
- type W
- func Background(background color.NRGBA, w W) W
- func Border(w W) W
- func BorderActive(w W) W
- func Button(clickable *Clickable, label string) W
- func Centered(w W) W
- func Chart[T Numeric](ds []T, height float32) W
- func Checkbox(btn *Clickable, value bool, onclick func()) W
- func CheckboxBool(btn *Clickable, value *bool) W
- func CheckboxBtn(value bool, btn *Clickable) W
- func Columns(children ...layout.FlexChild) W
- func ColumnsVCentered(children ...layout.FlexChild) W
- func Constraint(width, height int, w W) W
- func FormRow(children ...layout.FlexChild) W
- func Grid(l *List, count int, minItemSize int, ele layout.ListElement) W
- func HR(sz int) W
- func Icon(b []byte, color color.NRGBA) W
- func Label(s string) W
- func LayoutToWidget(r func(C, W) D, w W) W
- func OnClick(btn *Clickable, w W, onclick func()) W
- func Panel(title string, w W) W
- func RoundedCorners(w W) W
- func Rows(children ...layout.FlexChild) W
- func TabButton(cl *Clickable, active bool, l string) W
- func Text(s string) W
- func TextInput(editor *widget.Editor, hint string) W
- func ToolbarButton(clickable *Clickable, icon W, desc string) W
- func Tooltip(attachTo W, s string) W
- func VR(sz int) W
- func WidgetIf(cond bool, w W) W
- func Wrap(w W, wrappers ...Wrapper) W
- func ZebraList(l *List, len int, ele layout.ListElement) W
- type Wrapper
Examples ¶
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 ( IconFolder = Icon(icons.FileFolderOpen, Theme.SecondaryTextColor) IconFile = Icon(icons.ActionDescription, Theme.SecondaryTextColor) IconUp = Icon(icons.NavigationArrowUpward, Theme.TextColor) )
View Source
var ( IconCheckbox = Inset05(Icon(icons.ToggleCheckBoxOutlineBlank, Theme.CheckboxColor)) IconCheckboxActive = Inset05(Icon(icons.ToggleCheckBox, Theme.CheckboxColor)) )
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) )
View Source
var ( Inset05 = LayoutToWrapper(layout.UniformInset(SpaceUnit * 0.5).Layout) Inset1 = LayoutToWrapper(layout.UniformInset(SpaceUnit).Layout) Inset2 = LayoutToWrapper(layout.UniformInset(SpaceUnit * 2).Layout) Inset3 = LayoutToWrapper(layout.UniformInset(SpaceUnit * 3).Layout) Inset4 = LayoutToWrapper(layout.UniformInset(SpaceUnit * 4).Layout) Inset5 = LayoutToWrapper(layout.UniformInset(SpaceUnit * 5).Layout) Inset6 = LayoutToWrapper(layout.UniformInset(SpaceUnit * 6).Layout) )
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 Bold = FontWeight(font.Bold)
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, BorderRadius: 10, 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: MixColor(SILVER_100, SILVER_300, 75), CheckboxColor: ACCENT_COLOR_500, }
View Source
var (
ToolbarBgColor = SILVER_100
)
Functions ¶
func LineEditor ¶
Types ¶
type ClickableList ¶
func NewClickableList ¶
func NewClickableList() ClickableList
func (*ClickableList) Layout ¶
func (l *ClickableList) Layout(len int, ele layout.ListElement, onClick func(i int)) W
type DirectoryBrowser ¶
func NewDirectoryBrowser ¶
func NewDirectoryBrowser() DirectoryBrowser
func (*DirectoryBrowser) Layout ¶
func (d *DirectoryBrowser) Layout(dist *string) W
type Numeric ¶
type Numeric interface { constraints.Float | constraints.Integer }
type ThemeStyle ¶
type ThemeStyle struct { FontSize SP FontFamily *text.Shaper FontWeight font.Weight TextAlignment text.Alignment TextColor color.NRGBA MaxLines int BorderRadius int BackgroundColor color.NRGBA SecondaryTextColor color.NRGBA DangerColor color.NRGBA SuccessColor color.NRGBA WarningColor color.NRGBA InputBgColor color.NRGBA ViewsBgColor color.NRGBA SidebarBgColor color.NRGBA BorderColor color.NRGBA ActiveBorderColor color.NRGBA CardColor color.NRGBA CheckboxColor color.NRGBA }
type W ¶
func Background ¶
Example ¶
colors := []color.NRGBA{ STRAWBERRY_100, STRAWBERRY_300, STRAWBERRY_500, STRAWBERRY_700, STRAWBERRY_900, ORANGE_100, ORANGE_300, ORANGE_500, ORANGE_700, ORANGE_900, BANANA_100, BANANA_300, BANANA_500, BANANA_700, BANANA_900, LIME_100, LIME_300, LIME_500, LIME_700, LIME_900, MINT_100, MINT_300, MINT_500, MINT_700, MINT_900, BLUEBERRY_100, BLUEBERRY_300, BLUEBERRY_500, BLUEBERRY_700, BLUEBERRY_900, BUBBLEGUM_100, BUBBLEGUM_300, BUBBLEGUM_500, BUBBLEGUM_700, BUBBLEGUM_900, GRAPE_100, GRAPE_300, GRAPE_500, GRAPE_700, GRAPE_900, COCOA_100, COCOA_300, COCOA_500, COCOA_700, COCOA_900, SILVER_100, SILVER_300, SILVER_500, SILVER_700, SILVER_900, SLATE_100, SLATE_300, SLATE_500, SLATE_700, SLATE_900, BLACK_100, BLACK_300, BLACK_500, BLACK_700, BLACK_900, } l := NewVerticalList() w := func(c C) D { return l.Layout(c, len(colors), func(c C, i int) D { return Background(colors[i], Text(""))(c) }) } exampleLoop(w)
Output:
func Border ¶
Example ¶
box := Inset1( Border( Inset1( Text("Normal Border"), ), ), ) boxActive := Inset1( BorderActive( Inset1( Text("Active Border"), ), ), ) exampleLoop( Rows( Flexed(1, box), Flexed(1, boxActive), ), )
Output:
func BorderActive ¶
func Chart ¶
Example ¶
exampleLoop( Rows( Flexed(1, Chart([]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1}, 100)), Flexed(1, Chart([]int{1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 9, 1, 5, 1}, 100)), ), )
Output:
func CheckboxBool ¶
func CheckboxBtn ¶
func ColumnsVCentered ¶
func Constraint ¶
func HR ¶
Example ¶
exampleLoop( Inset1( Rows( Flexed(1, Text("Line 1")), Flexed(1, HR(1)), Flexed(1, Text("Line 2")), Flexed(1, HR(2)), Flexed(1, Text("Line 3")), ), ), )
Output:
func RoundedCorners ¶
Example ¶
box := Inset1( RoundedCorners( Background( STRAWBERRY_100, Inset1( Text("Hello world"), ), ), ), ) exampleLoop( Rows( Flexed(1, box), Flexed(1, box), Flexed(1, box), ), )
Output:
Click to show internal directories.
Click to hide internal directories.