Add Icons to Proxy Groups
Add Icons to Proxy Groups
Note
Icons are only supported by Mihomo and Clash Rust kernels. Clash Premium does not support them.
Uses icon sets from Koolson/Qure and flag icons from HatScripts/circle-flags.
/** @type {config} */export default function (profile) { /** * Add an icon to a proxy group. * @param {string} name - Proxy group name * @param {string} [iconset] - Icon name or URL */ const addIcon = (name, iconset) => { for (let group of profile["proxy-groups"]) { if (group.name === name) { if (!iconset) { iconset = name; } group["icon"] = iconset.startsWith("http") ? iconset : `https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/${iconset}.png`; } } };
// Define your own proxy group icons here addIcon("HK", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/hk.svg"); addIcon("TW", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/tw.svg"); addIcon("JP", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/jp.svg"); addIcon("SG", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/sg.svg"); addIcon("US", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/us.svg"); addIcon("Apple"); addIcon("Netflix"); addIcon("YouTube"); addIcon("Netflix"); addIcon("Disney", "Disney+"); addIcon("Microsoft"); addIcon("OpenAI", "ChatGPT"); addIcon("PayPal"); addIcon("Spotify"); addIcon("Steam"); addIcon("Telegram"); addIcon("Bilibili", "bilibili"); addIcon("Google"); addIcon("Bahamut"); addIcon("Proxies", "Global"); addIcon("Final");
return profile;}-- Add icons to proxy groupslocal function addIcon(name, iconset) if config["proxy-groups"] ~= nil then for _, group in ipairs(config["proxy-groups"]) do if group["name"] == name then if iconset == nil then iconset = name end group["icon"] = iconset:find("^http") and iconset or "https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/" .. iconset .. ".png" end end endend
-- Define your own proxy group icons hereaddIcon("HK", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/hk.svg")addIcon("TW", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/tw.svg")addIcon("JP", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/jp.svg")addIcon("SG", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/sg.svg")addIcon("US", "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/us.svg")addIcon("Apple")addIcon("Netflix")addIcon("YouTube")addIcon("Netflix")addIcon("Disney", "Disney+")addIcon("Microsoft")addIcon("OpenAI", "ChatGPT")addIcon("PayPal")addIcon("Spotify")addIcon("Steam")addIcon("Telegram")addIcon("Bilibili", "bilibili")addIcon("Google")addIcon("Bahamut")addIcon("Proxies", "Global")addIcon("Final")
return configfilter__proxy-groups: - when: | item.name == 'HK' merge: icon: "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/hk.svg" - when: | item.name == 'TW' merge: icon: "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/tw.svg" - when: | item.name == 'JP' merge: icon: "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/jp.svg" - when: | item.name == 'SG' merge: icon: "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/sg.svg" - when: | item.name == 'US' merge: icon: "https://raw.githubusercontent.com/HatScripts/circle-flags/gh-pages/flags/us.svg" - when: | item.name == 'Apple' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Apple.png - when: | item.name == 'Netflix' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Netflix.png - when: | item.name == 'YouTube' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/YouTube.png - when: | item.name == 'Disney' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Disney%2B.png - when: | item.name == 'Microsoft' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Microsoft.png - when: | item.name == 'OpenAI' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/ChatGPT.png - when: | item.name == 'PayPal' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/PayPal.png - when: | item.name == 'Spotify' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Spotify.png - when: | item.name == 'Steam' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Steam.png - when: | item.name == 'Telegram' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Telegram.png - when: | item.name == 'Bilibili' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/bilibili.png - when: | item.name == 'Google' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Google.png - when: | item.name == 'Bahamut' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Bahamut.png - when: | item.name == 'Proxies' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Global.png - when: | item.name == 'Final' merge: icon: https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Final.png