icons

package
v0.0.0-...-290cb81 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Overview

Package icons provides an interface for using icon fonts in a bar. To use an icon font:

  • Clone a supported repository
  • Link the ttf into ~/.fonts
  • Load the icon by passing it the path to the repo
  • Use icons as pango constructs in your bar

Compatible icon fonts:

  • Material Design Icons (+community fork)
  • FontAwesome
  • Typicons

Example usage:

material.Load("/Users/me/Github/google/material-design-icons")
...
return pango.Icon("material-today").Color(colors.Hex("#ddd")).
    Append(pango.Text(now.Sprintf("%H:%M")))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SymbolFromHex

func SymbolFromHex(hex string) (string, error)

SymbolFromHex parses a hex string (e.g. "1F44D") and converts it to a string (e.g. "👍").

Types

type Provider

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

Provider provides pango nodes for icons

func NewProvider

func NewProvider(name string) *Provider

NewProvider creates a new icon provider with the given name, registers it with pango.Icon, and returns it so that an appropriate Load method can be used.

func (*Provider) AddStyle

func (p *Provider) AddStyle(style func(*pango.Node))

AddStyle sets additional styles on all returned pango nodes.

func (*Provider) Font

func (p *Provider) Font(font string)

Font sets the font set on the returned pango nodes.

func (*Provider) Hex

func (p *Provider) Hex(name, value string) error

Hex adds a symbol to the provider where the value is given in hex-encoded form.

func (*Provider) Symbol

func (p *Provider) Symbol(name, value string)

Symbol adds a symbol to the provider where the value is the symbol/string to use for the icon.

Directories

Path Synopsis
Package fontawesome provides support for FontAwesome Icons from https://github.com/FortAwesome/Font-Awesome
Package fontawesome provides support for FontAwesome Icons from https://github.com/FortAwesome/Font-Awesome
Package material provides support for Google's Material Design Icons from https://github.com/google/material-design-icons
Package material provides support for Google's Material Design Icons from https://github.com/google/material-design-icons
Package mdi provides support for "Material Design Icons" from https://materialdesignicons.com/, a fork and extension of Material.
Package mdi provides support for "Material Design Icons" from https://materialdesignicons.com/, a fork and extension of Material.
Package typicons provides support for Typicons from https://github.com/stephenhutchings/typicons.font
Package typicons provides support for Typicons from https://github.com/stephenhutchings/typicons.font

Jump to

Keyboard shortcuts

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