Skip to content
internal/icons
On this page

The language icons drawn beside a code block's label: inline SVGs under 500 bytes each, in a brand-colored variant and a monochrome one that follows text.

#internal/icons

#internal/icons

Package icons provides the language icons drawn beside a code block's language label.

Each icon is an inline SVG with viewBox="0 0 16 16" and is kept under 500 bytes. Two variants exist per language: colorful, which uses the language's brand colors, and monochrome, which paints with currentColor so the icon follows the surrounding text.

#ValidCodeIconModes

Go go
var ValidCodeIconModes = []string{"colorful", "monochrome", "none"}

ValidCodeIconModes lists every accepted value of the code-icon mode, in the order the Python declared them. "none" suppresses icons entirely.

The slice is package state a caller must not write to.

#Icon

Go go
type Icon struct

Icon is the pair of inline SVG documents a language has.

#GetIcon

Go go
func GetIcon(language, mode string) (string, bool)

GetIcon returns the inline SVG icon for language in the given mode, and whether one exists.

language is matched case-insensitively and aliases are resolved ("js" -> "javascript", "sh" -> "bash"). mode is one of [ValidCodeIconModes]; "none" always reports no icon, and any unrecognized mode is treated as "colorful", which is what the Python did with its default argument.

Search