material_icon_gen

package module
v0.0.0-...-a4e44c2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 17 Imported by: 1

README

material-icon-gen

A generation toolkit for material design icons as PNG or SVG in configurable sizes.

List of all icons: https://material.io/resources/icons/?style=twotone

Documentation

Index

Constants

View Source
const (
	DefaultSvgURL = "https://github.com/dreadl0ck/material-icons.git"
	DefaultPngURL = "https://github.com/dreadl0ck/material-icons-png.git"
)

Variables

This section is empty.

Functions

func CloneIcons

func CloneIcons(path string, url string)

func GenerateAdditionalIcons

func GenerateAdditionalIcons(path string, subset map[string]string, hook func(newBase string, color string))

this will generate a subset of the icons with a different imgType call after generateIcons, the image repo needs to be present

func GenerateAdditionalIconsSVG

func GenerateAdditionalIconsSVG(path string, sizes []int, subset map[string]string, hook func(newBase string, color string))

func GenerateIconPNG

func GenerateIconPNG(path string, text string)

func GenerateIconSVG

func GenerateIconSVG(path string, text string, sizes []int) string

func GenerateIconsPNG

func GenerateIconsPNG(path, url string, hook func(newBase string, color string))

func GenerateIconsSVG

func GenerateIconsSVG(path string, url string, sizes []int, coloredIcons map[string][]string, hook func(newBase string, color string))

func GenerateSizes

func GenerateSizes(newBase string, newPath string)

func GenerateSizesSVG

func GenerateSizesSVG(newBase string, newPath string, color string, sizes []int)

Types

type MaterialIconSVG

type MaterialIconSVG struct {
	XMLName xml.Name `xml:"svg"`

	Xmlns   string `xml:"xmlns,attr"`
	Width   string `xml:"width,attr"`
	Height  string `xml:"height,attr"`
	ViewBox string `xml:"viewBox,attr"`
	Paths   []Path `xml:"path"`

	Rect *struct {
		Text        string `xml:",chardata"`
		X           string `xml:"x,attr"`
		Y           string `xml:"y,attr"`
		Width       string `xml:"width,attr"`
		Height      string `xml:"height,attr"`
		Stroke      string `xml:"stroke,attr"`
		StrokeWidth string `xml:"stroke-width,attr"`
		Fill        string `xml:"fill,attr"`
	} `xml:"rect,omitempty"`

	Text *struct {
		Text             string `xml:",chardata"`
		X                string `xml:"x,attr"`
		Y                string `xml:"y,attr"`
		DominantBaseline string `xml:"dominant-baseline,attr"`
		TextAnchor       string `xml:"text-anchor,attr"`
	} `xml:"text,omitempty"`
}

MaterialIconSVG models the material icon svg structure

func (*MaterialIconSVG) ResizeSVG

func (s *MaterialIconSVG) ResizeSVG(width, height int)

type Path

type Path struct {
	Text    string `xml:",chardata"`
	Opacity string `xml:"opacity,attr"`
	D       string `xml:"d,attr"`
	Style   string `xml:"style,attr,omitempty"`
}

Jump to

Keyboard shortcuts

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