icons

package
v0.0.0-...-1143ee3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

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
  • Ionicons
  • Typicons

Example usage:

material.Load("/Users/me/Github/google/material-design-icons")
...
return pango.Span(
  material.Icon("today", colors.Hex("#ddd")),
  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 Config

type Config struct {
	RepoPath string
	FilePath string
	Font     string
	// contains filtered or unexported fields
}

Config stores Configuration options for building an IconProvider.

func (*Config) LoadByLines

func (c *Config) LoadByLines(parseLine func(string, func(string, string)) error) (*Provider, error)

LoadByLines creates an IconProvider by passing to the parse function each line of the source file, and a function to add icons to the provider's map.

func (*Config) LoadFromFile

func (c *Config) LoadFromFile(parseFile func(io.Reader, func(string, string)) error) (*Provider, error)

LoadFromFile creates an IconProvider by passing to the parse function an io.Reader for the source file, and a function to add icons to the provider's map.

func (*Config) Styles

func (c *Config) Styles(attrs ...pango.Attribute)

Styles sets any default pango styles (e.g. weight, baseline) that should apply to all icons. User-defined styles will override any styles provided here.

type Provider

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

Provider provides pango nodes for icons

func (*Provider) Icon

func (p *Provider) Icon(name string, style ...pango.Attribute) pango.Node

Icon creates a pango span that renders the named icon. It looks up the name in the loaded mapping, and if found, merges the default styles with the user provided styles (if any) to produce a <span> that will render the requested 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 ionicons provides support for Ionicicons from https://github.com/driftyco/ionicons
Package ionicons provides support for Ionicicons from https://github.com/driftyco/ionicons
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 materialCommunity provides support for the community fork "Material Design Icons" from https://materialdesignicons.com/
Package materialCommunity provides support for the community fork "Material Design Icons" from https://materialdesignicons.com/
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