isoicons

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

README

go-widgets/isoicons

CI release pkg.go.dev coverage license

Reusable isometric icon packs for the go-widgets/toolkit isometric-diagram widget. Two packs of ready-to-place isometric artwork are registered into a toolkit.IsoIconRegistry as billboarded sprite icons — no drawing code, just name a node's icon by id.

Pure Go, CGO_ENABLED=0, and GOOS=js GOARCH=wasm-clean: PNG art is decoded with the standard library's image/png, and SVG art is rasterized with the pure-Go oksvg + rasterx rasterizer. 100% statement coverage.

Packs

Pack id prefix concepts source art how it loads
cloudnative cloudnative/… 44 128px PNG, fjudith/cloud-native-isometric-icons (Apache-2.0) //go:embed + image/png decode
aws aws/… 9 SVG, danieljoos/isometric-cloud-icons (CC0-1.0) //go:embed + oksvg/rasterx raster

Every id is namespaced by its pack (cloudnative/pod, aws/aws-lambda) so the packs never collide with each other or with the toolkit's built-in icons. Two cloudnative concepts — container and package — ship theme-aware light/dark variants selected by the Theme argument; all others are neutral.

Install

go get github.com/go-widgets/isoicons

Usage

package main

import (
	"github.com/go-widgets/isoicons"
	"github.com/go-widgets/toolkit"
)

func main() {
	reg := toolkit.NewIsoIconRegistry()

	// Register both packs; light theme for the theme-aware concepts (default).
	if err := isoicons.RegisterAll(reg); err != nil {
		panic(err)
	}

	// Or a single pack, with an explicit theme:
	//   isoicons.RegisterCloudNative(reg, isoicons.ThemeDark)
	//   isoicons.RegisterAWS(reg)

	// A diagram node can now name any registered id:
	icon, ok := reg.Resolve("cloudnative/pod") // -> toolkit.IsoSpriteIcon, true
	_ = icon
	_ = ok

	// List what is installed, per pack:
	_ = isoicons.CloudNativeIDs() // []string{"cloudnative/apiserver", ...}
	_ = isoicons.AWSIDs()         // []string{"aws/aws-api-gateway", ...}
}

API

type Theme int
const (
	ThemeLight Theme = iota // default
	ThemeDark
)

// Register one pack, both packs, and list the ids of each.
func RegisterCloudNative(reg *toolkit.IsoIconRegistry, theme ...Theme) error
func RegisterAWS(reg *toolkit.IsoIconRegistry) error
func RegisterAll(reg *toolkit.IsoIconRegistry, theme ...Theme) error
func CloudNativeIDs() []string
func AWSIDs() []string

theme is variadic; omit it for ThemeLight. RegisterAWS takes no theme (the AWS art is fixed-colour). Each Register* returns an error only if a vendored asset fails to decode/parse — impossible with the shipped, tested assets, but surfaced rather than swallowed.

cloudnative concepts (44)

Kubernetes control plane: apiserver, controller-manager, scheduler, kubelet, kube-proxy, cloud-controller-manager. Kubernetes infrastructure: etcd, master, node. Kubernetes resources: pod, deployment, statefulset, daemonset, job, cronjob, configmap, secret, namespace, ingress, service, persistent-volume, persistent-volume-claim. Compute: server, server-rack, virtual-machine, micro-vm, storage-server, cloud. Networking: dns, internet, load-balancer. Repositories: code-repository, container-registry. Storage: object-storage, folder, documents, index. Pipelines: deployment-pipeline, integration-pipeline, drone. Data services: postgresql, minio. Theme-aware (light/dark): container, package.

aws concepts (9)

aws-api-gateway, aws-cloudfront, aws-cognito-identity-pool, aws-dynamodb, aws-lambda, aws-s3-bucket, black-box, low-block-rounded-blue, webapp.

Licensing

This repository carries a triple licensing regime — the Go code and each asset pack are licensed independently:

Component License Holder
Go source code (this repo) BSD-3-Clause the go-widgets/isoicons authors
assets/cloudnative/*.png Apache-2.0 fjudith
assets/aws/*.svg CC0-1.0 danieljoos (public domain)

The assets are vendored unmodified. See NOTICE for the exact upstream repositories, commit SHAs, and raw URLs, and each assets/<pack>/LICENSE for the full license text. CC0-1.0 requires no attribution; the source is recorded only for traceability.

Total vendored asset weight: ~592 KB (540 KB PNG + 52 KB SVG).

Documentation

Overview

Package isoicons provides reusable isometric icon packs for the github.com/go-widgets/toolkit isometric-diagram widget.

Two packs are shipped, each vendored from a permissively licensed upstream and registered into a toolkit.IsoIconRegistry as billboarded sprite icons (toolkit.IsoSpriteIcon):

  • "cloudnative": ~45 cloud-native concepts (Kubernetes control-plane and resources, servers, networking, storage, pipelines, …) decoded from embedded 128px PNG art. Two concepts ("container", "package") ship theme-aware light/dark variants selected by the Theme argument.
  • "aws": the nine isometric AWS/cloud SVGs, rasterized at load time with the pure-Go github.com/srwiley/oksvg + github.com/srwiley/rasterx rasterizer (CGO-free, wasm-clean).

Every id is namespaced by its pack ("cloudnative/pod", "aws/aws-lambda") so the two packs never collide with each other or with the toolkit's built-in icons. All code in this repository is BSD-3-Clause; the vendored assets keep their upstream licenses (assets/cloudnative is Apache-2.0, assets/aws is CC0-1.0) — see the NOTICE file and each assets/*/LICENSE.

The package is pure Go (CGO_ENABLED=0) and compiles for GOOS=js GOARCH=wasm: the PNG decoder is image/png from the standard library and the SVG rasterizer is pure Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSIDs

func AWSIDs() []string

AWSIDs returns the registered ids of the "aws" pack, in a stable order.

func CloudNativeIDs

func CloudNativeIDs() []string

CloudNativeIDs returns the registered ids of the "cloudnative" pack, in a stable order — for building a palette or listing the installed library.

func RegisterAWS

func RegisterAWS(reg *toolkit.IsoIconRegistry) error

RegisterAWS registers the "aws" pack into reg, rasterizing each vendored SVG at load time. It returns an error only if a vendored asset fails to parse.

func RegisterAll

func RegisterAll(reg *toolkit.IsoIconRegistry, theme ...Theme) error

RegisterAll registers both packs into reg. The optional theme is forwarded to the "cloudnative" pack (the "aws" pack is fixed-colour).

func RegisterCloudNative

func RegisterCloudNative(reg *toolkit.IsoIconRegistry, theme ...Theme) error

RegisterCloudNative registers the "cloudnative" pack into reg. The optional theme (default ThemeLight) selects the variant for the theme-aware concepts; every other concept ships a single neutral variant. It returns an error only if a vendored asset fails to decode.

Types

type Theme

type Theme int

Theme selects, for a concept that ships two variants, which one is registered. Concepts with a single neutral variant ignore it.

const (
	// ThemeLight registers the light-background variant (the default).
	ThemeLight Theme = iota
	// ThemeDark registers the dark-background variant.
	ThemeDark
)

Jump to

Keyboard shortcuts

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