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)
| 50 | // - ThemeDark: light icons for dark backgrounds |
| 51 | // If the icon is not found in the embedded filesystem, it returns an empty string. |
| 52 | func 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. |
no outgoing calls