icons

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 6 Imported by: 0

README

icons

This repository contains icons collections raedy to be used with Fyne framework. This project is NOT affiliated with any of the source repositories.

It contains the following icons:

All of those collections are represented as separate Go packages. There is also common convenience package github.com/gosthome/icons. It can be used like this:


package main

import (
	// Import common package
	"github.com/gosthome/icons"

	// This imports are important as they register respective collection
	// in the common package. Collection name is the same name as package
	// `materialdesignicons:123` for icon 123 in materialdesignicons
	_ "github.com/gosthome/icons/google/materialdesignicons"
	// `materialdesigniconsoutlined:123` for icon `123` in `materialdesigniconsoutlined` collection
	_ "github.com/gosthome/icons/google/materialdesigniconsoutlined"
	// `materialdesigniconsround:123` for icon `123` in `materialdesigniconsround` collection
	_ "github.com/gosthome/icons/google/materialdesigniconsround"
	// `materialdesigniconssharp:123` for icon `123` in `materialdesigniconssharp` collection
	_ "github.com/gosthome/icons/google/materialdesigniconssharp"
	// `mdi:chip` for icon `chip` in `mdi` collection
	_ "github.com/gosthome/icons/templarian/mdi"
	// `faBrands:google` for icon `google` in `faBrands` collection
	_ "github.com/gosthome/icons/fortawesome/faBrands"
	// `faSolid:address-card` for icon address-`card` in `faRegular` collection
	_ "github.com/gosthome/icons/fortawesome/faRegular"
	// `faSolid:address-card` for icon address-`card` in `faSolid` collection
	_ "github.com/gosthome/icons/fortawesome/faSolid"
)


func main(){
	// ...
	p, err := icons.Parse(iconText)
	if err != nil {
		// handle err
		return
	}
	r := p.GetResource()
	if r == nil {
		// handle err
		return
	}
	icon := theme.NewColoredResource(
			r,
			theme.ColorNameForeground,
	)
	// use icon
	// ...
}

See the full working example of icon parsing here. There is also a small test application same to MDI Icon Picker. It runs a fuzzy search on mdi icons and then shows appropriate icon(s).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection map[string]*fyne.StaticResource

func RegisteredCollection

func RegisteredCollection(name string, c Collection) Collection

type Collections

type Collections map[string]Collection

type Icon

type Icon struct {
	Collection string
	Icon       string
}

func Parse

func Parse(s string) (*Icon, error)

func (*Icon) GetResource

func (i *Icon) GetResource() fyne.Resource

func (*Icon) MarshalText

func (i *Icon) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler.

func (*Icon) String

func (i *Icon) String() string

String implements fmt.Stringer.

func (*Icon) UnmarshalString

func (i *Icon) UnmarshalString(text string) error

func (*Icon) UnmarshalText

func (i *Icon) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

Directories

Path Synopsis
fortawesome
google
templarian
mdi

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳