theme

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HeaderColor             = &unison.ThemeColor{Light: unison.RGB(43, 43, 43), Dark: unison.RGB(64, 64, 64)}
	OnHeaderColor           = &unison.ThemeColor{Light: unison.White, Dark: unison.Silver}
	AccentColor             = &unison.ThemeColor{Light: unison.RGB(0, 102, 102), Dark: unison.RGB(100, 153, 153)}
	SearchListColor         = &unison.ThemeColor{Light: unison.LightCyan, Dark: unison.RGB(0, 43, 43)}
	OnSearchListColor       = &unison.ThemeColor{Light: unison.Black, Dark: unison.RGB(204, 204, 204)}
	PageColor               = &unison.ThemeColor{Light: unison.White, Dark: unison.RGB(16, 16, 16)}
	OnPageColor             = &unison.ThemeColor{Light: unison.Black, Dark: unison.RGB(160, 160, 160)}
	PageVoidColor           = &unison.ThemeColor{Light: unison.Grey, Dark: unison.Black}
	MarkerColor             = &unison.ThemeColor{Light: unison.RGB(252, 242, 196), Dark: unison.RGB(0, 51, 0)}
	OnMarkerColor           = &unison.ThemeColor{Light: unison.Black, Dark: unison.RGB(221, 221, 221)}
	OverloadedColor         = &unison.ThemeColor{Light: unison.RGB(192, 64, 64), Dark: unison.RGB(115, 37, 37)}
	OnOverloadedColor       = &unison.ThemeColor{Light: unison.White, Dark: unison.RGB(221, 221, 221)}
	HintColor               = &unison.ThemeColor{Light: unison.Grey, Dark: unison.RGB(64, 64, 64)}
	LinkColor               = &unison.ThemeColor{Light: unison.SpringGreen, Dark: unison.SpringGreen}
	OnLinkColor             = &unison.ThemeColor{Light: unison.Black, Dark: unison.Black}
	PDFLinkHighlightColor   = &unison.ThemeColor{Light: unison.SpringGreen, Dark: unison.SpringGreen}
	PDFMarkerHighlightColor = &unison.ThemeColor{Light: unison.Yellow, Dark: unison.Yellow}
)

Additional colors over and above what unison provides by default.

View Source
var (
	// CurrentColors holds the current theme.
	CurrentColors = []*ThemedColor{
		{ID: "background", Title: i18n.Text("Background"), Color: unison.BackgroundColor},
		{ID: "on_background", Title: i18n.Text("On Background"), Color: unison.OnBackgroundColor},
		{ID: "content", Title: i18n.Text("Content"), Color: unison.ContentColor},
		{ID: "on_content", Title: i18n.Text("On Content"), Color: unison.OnContentColor},
		{ID: "banding", Title: i18n.Text("Banding"), Color: unison.BandingColor},
		{ID: "on_banding", Title: i18n.Text("On Banding"), Color: unison.OnBandingColor},
		{ID: "header", Title: i18n.Text("Header"), Color: HeaderColor},
		{ID: "on_header", Title: i18n.Text("On Header"), Color: OnHeaderColor},
		{ID: "tab_focused", Title: i18n.Text("Focused Tab"), Color: unison.TabFocusedColor},
		{ID: "on_tab_focused", Title: i18n.Text("On Focused Tab"), Color: unison.OnTabFocusedColor},
		{ID: "tab_current", Title: i18n.Text("Current Tab"), Color: unison.TabCurrentColor},
		{ID: "on_tab_current", Title: i18n.Text("On Current Tab"), Color: unison.OnTabCurrentColor},
		{ID: "editable", Title: i18n.Text("Editable"), Color: unison.EditableColor},
		{ID: "on_editable", Title: i18n.Text("On Editable"), Color: unison.OnEditableColor},
		{ID: "selection", Title: i18n.Text("Selection"), Color: unison.SelectionColor},
		{ID: "on_selection", Title: i18n.Text("On Selection"), Color: unison.OnSelectionColor},
		{ID: "inactive_selection", Title: i18n.Text("Inactive Selection"), Color: unison.InactiveSelectionColor},
		{ID: "on_inactive_selection", Title: i18n.Text("On Inactive Selection"), Color: unison.OnInactiveSelectionColor},
		{ID: "indirect_selection", Title: i18n.Text("Indirect Selection"), Color: unison.IndirectSelectionColor},
		{ID: "on_indirect_selection", Title: i18n.Text("On Indirect Selection"), Color: unison.OnIndirectSelectionColor},
		{ID: "scroll", Title: i18n.Text("Scroll"), Color: unison.ScrollColor},
		{ID: "scroll_rollover", Title: i18n.Text("Scroll Rollover"), Color: unison.ScrollRolloverColor},
		{ID: "scroll_edge", Title: i18n.Text("Scroll Edge"), Color: unison.ScrollEdgeColor},
		{ID: "control_edge", Title: i18n.Text("Control Edge"), Color: unison.ControlEdgeColor},
		{ID: "control", Title: i18n.Text("Control"), Color: unison.ControlColor},
		{ID: "on_control", Title: i18n.Text("On Control"), Color: unison.OnControlColor},
		{ID: "control_pressed", Title: i18n.Text("Pressed Control"), Color: unison.ControlPressedColor},
		{ID: "on_control_pressed", Title: i18n.Text("On Pressed Control"), Color: unison.OnControlPressedColor},
		{ID: "divider", Title: i18n.Text("Divider"), Color: unison.DividerColor},
		{ID: "interior_divider", Title: i18n.Text("Interior Divider"), Color: unison.InteriorDividerColor},
		{ID: "icon_button", Title: i18n.Text("Icon Button"), Color: unison.IconButtonColor},
		{ID: "icon_button_rollover", Title: i18n.Text("Icon Button Rollover"), Color: unison.IconButtonRolloverColor},
		{ID: "icon_button_pressed", Title: i18n.Text("Pressed Icon Button"), Color: unison.IconButtonPressedColor},
		{ID: "hint", Title: i18n.Text("Hint"), Color: HintColor},
		{ID: "tooltip", Title: i18n.Text("Tooltip"), Color: unison.TooltipColor},
		{ID: "on_tooltip", Title: i18n.Text("On Tooltip"), Color: unison.OnTooltipColor},
		{ID: "search_list", Title: i18n.Text("Search List"), Color: SearchListColor},
		{ID: "on_search_list", Title: i18n.Text("On Search List"), Color: OnSearchListColor},
		{ID: "marker", Title: i18n.Text("Marker"), Color: MarkerColor},
		{ID: "on_marker", Title: i18n.Text("On Marker"), Color: OnMarkerColor},
		{ID: "error", Title: i18n.Text("Error"), Color: unison.ErrorColor},
		{ID: "on_error", Title: i18n.Text("On Error"), Color: unison.OnErrorColor},
		{ID: "warning", Title: i18n.Text("Warning"), Color: unison.WarningColor},
		{ID: "on_warning", Title: i18n.Text("On Warning"), Color: unison.OnWarningColor},
		{ID: "overloaded", Title: i18n.Text("Overloaded"), Color: OverloadedColor},
		{ID: "on_overloaded", Title: i18n.Text("On Overloaded"), Color: OnOverloadedColor},
		{ID: "page", Title: i18n.Text("Page"), Color: PageColor},
		{ID: "on_page", Title: i18n.Text("On Page"), Color: OnPageColor},
		{ID: "page_void", Title: i18n.Text("Page Void"), Color: PageVoidColor},
		{ID: "drop_area", Title: i18n.Text("Drop Area"), Color: unison.DropAreaColor},
		{ID: "link", Title: i18n.Text("Link"), Color: LinkColor},
		{ID: "on_link", Title: i18n.Text("On Link"), Color: OnLinkColor},
		{ID: "pdf_link", Title: i18n.Text("PDF Link Highlight"), Color: PDFLinkHighlightColor},
		{ID: "pdf_marker", Title: i18n.Text("PDF Marker Highlight"), Color: PDFMarkerHighlightColor},
		{ID: "accent", Title: i18n.Text("Accent"), Color: AccentColor},
	}
	// FactoryColors holds the original theme before any modifications.
	FactoryColors []*ThemedColor
)

Additional fonts over and above what unison provides by default.

View Source
var (
	// CurrentFonts holds the current theme fonts.
	CurrentFonts = []*ThemedFont{
		{ID: "system", Title: i18n.Text("System"), Font: unison.SystemFont},
		{ID: "system.emphasized", Title: i18n.Text("System (Emphasized)"), Font: unison.EmphasizedSystemFont},
		{ID: "system.small", Title: i18n.Text("System (Small)"), Font: unison.SmallSystemFont},
		{ID: "system.small.emphasized", Title: i18n.Text("System (Small, Emphasized)"), Font: unison.EmphasizedSmallSystemFont},
		{ID: "label", Title: i18n.Text("Label"), Font: unison.LabelFont},
		{ID: "field", Title: i18n.Text("Field"), Font: unison.FieldFont},
		{ID: "field.secondary", Title: i18n.Text("Secondary Fields"), Font: FieldSecondaryFont},
		{ID: "keyboard", Title: i18n.Text("Keyboard"), Font: unison.KeyboardFont},
		{ID: "page.field.primary", Title: i18n.Text("Page Primary Fields"), Font: PageFieldPrimaryFont},
		{ID: "page.field.secondary", Title: i18n.Text("Page Secondary Fields"), Font: PageFieldSecondaryFont},
		{ID: "page.label.primary", Title: i18n.Text("Page Primary Labels"), Font: PageLabelPrimaryFont},
		{ID: "page.label.secondary", Title: i18n.Text("Page Secondary Labels"), Font: PageLabelSecondaryFont},
		{ID: "page.footer.primary", Title: i18n.Text("Page Primary Footer"), Font: PageFooterPrimaryFont},
		{ID: "page.footer.secondary", Title: i18n.Text("Page Secondary Footer"), Font: PageFooterSecondaryFont},
	}
	// FactoryFonts holds the original theme before any modifications.
	FactoryFonts []*ThemedFont
)

Functions

This section is empty.

Types

type Colors

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

Colors holds a set of themed colors.

func NewColorsFromFS

func NewColorsFromFS(fileSystem fs.FS, filePath string) (*Colors, error)

NewColorsFromFS creates a new set of colors from a file. Any missing values will be filled in with defaults.

func (*Colors) MakeCurrent

func (c *Colors) MakeCurrent()

MakeCurrent applies these colors to the current theme color set and updates all windows.

func (*Colors) MarshalJSON

func (c *Colors) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Colors) Reset

func (c *Colors) Reset()

Reset to factory defaults.

func (*Colors) ResetOne

func (c *Colors) ResetOne(id string)

ResetOne resets one color by ID to factory defaults.

func (*Colors) Save

func (c *Colors) Save(filePath string) error

Save writes the Colors to the file as JSON.

func (*Colors) UnmarshalJSON

func (c *Colors) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Fonts

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

Fonts holds a set of themed fonts.

func NewFontsFromFS

func NewFontsFromFS(fileSystem fs.FS, filePath string) (*Fonts, error)

NewFontsFromFS creates a new set of fonts from a file. Any missing values will be filled in with defaults.

func (*Fonts) MakeCurrent

func (f *Fonts) MakeCurrent()

MakeCurrent applies these fonts to the current theme font set and updates all windows.

func (*Fonts) MarshalJSON

func (f *Fonts) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Fonts) Reset

func (f *Fonts) Reset()

Reset to factory defaults.

func (*Fonts) ResetOne

func (f *Fonts) ResetOne(id string)

ResetOne resets one font by ID to factory defaults.

func (*Fonts) Save

func (f *Fonts) Save(filePath string) error

Save writes the Fonts to the file as JSON.

func (*Fonts) UnmarshalJSON

func (f *Fonts) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ThemedColor

type ThemedColor struct {
	ID    string
	Title string
	Color *unison.ThemeColor
}

ThemedColor holds a themed color.

type ThemedFont

type ThemedFont struct {
	ID    string
	Title string
	Font  *unison.IndirectFont
}

ThemedFont holds a themed font.

Jump to

Keyboard shortcuts

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