MCPcopy
hub / github.com/github/github-mcp-server / DataURI

Function DataURI

pkg/octicons/octicons.go:52–59  ·  view source on GitHub ↗

DataURI returns a data URI for the embedded Octicon PNG. The theme parameter specifies which variant to use: - ThemeLight: dark icons for light backgrounds - ThemeDark: light icons for dark backgrounds If the icon is not found in the embedded filesystem, it returns an empty string.

(name string, theme Theme)

Source from the content-addressed store, hash-verified

50// - ThemeDark: light icons for dark backgrounds
51// If the icon is not found in the embedded filesystem, it returns an empty string.
52func DataURI(name string, theme Theme) string {
53 filename := fmt.Sprintf("icons/%s-%s.png", name, theme)
54 data, err := iconsFS.ReadFile(filename)
55 if err != nil {
56 return ""
57 }
58 return "data:image/png;base64," + base64.StdEncoding.EncodeToString(data)
59}
60
61// Icons returns MCP Icon objects for the given octicon name in light and dark themes.
62// Icons are embedded as 24x24 PNG data URIs for offline use and faster loading.

Callers 4

TestDataURIFunction · 0.85
TestIconsFunction · 0.85
TestEmbeddedIconsExistFunction · 0.85
IconsFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestDataURIFunction · 0.68
TestIconsFunction · 0.68
TestEmbeddedIconsExistFunction · 0.68