{"id":29480958,"url":"https://github.com/codelif/xdgicons","last_synced_at":"2025-07-14T23:55:11.845Z","repository":{"id":304255096,"uuid":"1018255796","full_name":"codelif/xdgicons","owner":"codelif","description":"Go Lookup functions for https://specifications.freedesktop.org/icon-theme-spec/latest/#icon_lookup","archived":false,"fork":false,"pushed_at":"2025-07-11T23:46:14.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-12T00:28:44.098Z","etag":null,"topics":["freedesktop","freedesktop-icon-theme","freedesktop-icons","go","golang","icons","xdg","xdg-icons"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/codelif/xdgicons","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codelif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-11T22:18:27.000Z","updated_at":"2025-07-11T23:46:00.000Z","dependencies_parsed_at":"2025-07-12T00:28:46.350Z","dependency_job_id":"39b99652-3d93-46c8-b2d0-026280d12582","html_url":"https://github.com/codelif/xdgicons","commit_stats":null,"previous_names":["codelif/xdgicons"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/codelif/xdgicons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelif%2Fxdgicons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelif%2Fxdgicons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelif%2Fxdgicons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelif%2Fxdgicons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelif","download_url":"https://codeload.github.com/codelif/xdgicons/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelif%2Fxdgicons/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265375226,"owners_count":23755190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freedesktop","freedesktop-icon-theme","freedesktop-icons","go","golang","icons","xdg","xdg-icons"],"created_at":"2025-07-14T23:55:10.478Z","updated_at":"2025-07-14T23:55:11.827Z","avatar_url":"https://github.com/codelif.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xdgicons\nGo Lookup functions for https://specifications.freedesktop.org/icon-theme-spec/latest/#icon_lookup\n\nAlso contains a basic SVG rendering API\n\n## WARNING: This is AI slop\nI wanted to get on with my other projects. And not deal with this spec. So I had this made. Seems to be working p much, though I can't guarantee.\n\nBelow are some AI slop examples as well:\n\n### Quick Start\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n\n    \"github.com/codelif/xdgicons\"\n)\n\nfunc main() {\n    // Create icon lookup instance\n    iconLookup := xdgicons.NewIconLookup()\n    \n    // Find an icon\n    iconPath, err := iconLookup.Lookup(\"firefox\")\n    if err != nil {\n        log.Fatal(err)\n    }\n    \n    fmt.Printf(\"Firefox icon: %s\\n\", iconPath)\n    // Output: Firefox icon: /usr/share/icons/hicolor/48x48/apps/firefox.png\n}\n```\n\n### Basic Icon Lookup\n\n```go\n// Simple lookup with default size (48px)\niconPath, err := iconLookup.Lookup(\"folder\")\n\n// Lookup with specific size\niconPath, err := iconLookup.LookupWithSize(\"folder\", 24)\n\n// Full control over size and scale\niconPath, err := iconLookup.FindIcon(\"text-editor\", 32, 2) // 32px at 2x scale\n\n// Symbolic icons\niconPath, err := iconLookup.LookupSymbolic(\"bluetooth\") // Finds bluetooth-symbolic\n```\n\n### Smart Fallbacks\n\n```go\n// Try multiple icon names with intelligent fallbacks\niconPath, err := iconLookup.FindBestIconWithFallbacks(\n    []string{\"blueman-send-symbolic\"}, 48, 1)\n// Will try: blueman-send-symbolic → blueman-send → document-send-symbolic → document-send\n\n// Multiple candidates (useful for MIME types)\niconPath, err := iconLookup.FindBestIcon(\n    []string{\"text-x-python\", \"text-x-script\", \"text-plain\"}, 48, 1)\n```\n\n### SVG Icon Rendering\n\n```go\nimport (\n    \"image/color\"\n\n    \"github.com/codelif/xdgicons\"\n)\n\n// Create renderer\nrenderer := xdgicons.NewIconRenderer(iconLookup)\n\n// Render SVG to PNG\nimg, err := renderer.RenderIconToPNG(\"firefox\", 48)\n\n// Render symbolic icon with custom color\nblueColor := color.RGBA{0, 120, 215, 255}\nimg, err := renderer.RenderSymbolicSVGToPNG(\n    \"/usr/share/icons/Adwaita/symbolic/devices/bluetooth-symbolic.svg\",\n    32, blueColor)\n\n// Smart rendering with fallbacks\nimg, iconPath, err := renderer.RenderIconWithFallback(\"bluetooth-symbolic\", 24, \u0026blueColor)\n```\n\n### Theme Management\n\n```go\n// Use specific theme\niconLookup := NewIconLookupWithTheme(\"Papirus\")\n\n// Change theme dynamically\niconLookup.SetTheme(\"Adwaita\")\n\n// Check current theme\nfmt.Println(\"Current theme:\", iconLookup.GetTheme())\n\n// Set custom icon directories\niconLookup.SetBaseDirs([]string{\n    \"/home/user/.local/share/icons\",\n    \"/usr/share/icons\",\n})\n```\n\n## Debugging Missing Icons\n\n```go\n// Debug why an icon isn't found\niconPath, searchPaths, err := iconLookup.DebugLookup(\"missing-icon\", 48, 1)\nif err != nil {\n    fmt.Printf(\"Icon not found. Searched %d paths:\\n\", len(searchPaths))\n    for i, path := range searchPaths[:5] { // Show first 5\n        fmt.Printf(\"  %d: %s\\n\", i+1, path)\n    }\n}\n\n// Get suggestions for alternative names\nsuggestions := iconLookup.SuggestIconAlternatives(\"blueman-send-symbolic\")\nfmt.Printf(\"Try these instead: %v\\n\", suggestions)\n// Output: [blueman-send document-send mail-send document-send-symbolic ...]\n\n// Debug theme structure\niconLookup.DebugThemeInfo(\"hicolor\")\n```\n\n## Installation\n\n```bash\ngo get github.com/codelif/xdgicons\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelif%2Fxdgicons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelif%2Fxdgicons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelif%2Fxdgicons/lists"}