"""Fetches Material Symbols (Rounded, Apache-2.0) and renders the icon pack to themes/cookie-glass/assets/icons. Keys are Discord design-system asset names; values are Material Symbol names. Unknown keys are ignored by Discord. """ import json, pathlib, subprocess, urllib.request MAP = { 'HomeIcon': 'home', 'ChatIcon': 'chat_bubble', 'BellIcon': 'notifications', 'SettingsIcon': 'settings', 'FriendsIcon': 'group', 'UserIcon': 'person', 'MagnifyingGlassIcon': 'search', 'PlusSmallIcon': 'add', 'PlusLargeIcon': 'add', 'MicrophoneIcon': 'mic', 'MicrophoneSlashIcon': 'mic_off', 'HeadphonesIcon': 'headphones', 'HeadphonesSlashIcon': 'headset_off', 'GiftIcon': 'redeem', 'ReactionIcon': 'add_reaction', 'ImageIcon': 'image', 'ImagePlusIcon': 'add_photo_alternate', 'ImageFileIcon': 'image', 'AtIcon': 'alternate_email', 'PinIcon': 'push_pin', 'ThreadIcon': 'forum', 'ThreadPlusIcon': 'add_comment', 'TextIcon': 'tag', 'VoiceNormalIcon': 'volume_up', 'CopyIcon': 'content_copy', 'TrashIcon': 'delete', 'StarIcon': 'star', 'HeartIcon': 'favorite', 'EyeIcon': 'visibility', 'PencilIcon': 'edit', 'LinkIcon': 'link', 'ArrowLargeLeftIcon': 'arrow_back', 'ArrowLargeRightIcon': 'arrow_forward', 'ArrowLargeUpIcon': 'arrow_upward', 'ArrowLargeDownIcon': 'arrow_downward', 'ChevronSmallRightIcon': 'chevron_right', 'ChevronSmallDownIcon': 'expand_more', 'ChevronSmallLeftIcon': 'chevron_left', 'ChevronSmallUpIcon': 'expand_less', 'XSmallIcon': 'close', 'XLargeIcon': 'close', 'CircleCheckIcon': 'check_circle', 'CircleInformationIcon': 'info', 'CircleErrorIcon': 'error', 'KeyboardIcon': 'keyboard', 'LanguageIcon': 'translate', 'GlobeEarthIcon': 'public', 'LightbulbIcon': 'lightbulb', 'GameControllerIcon': 'sports_esports', 'PaperIcon': 'description', 'PuzzlePieceIcon': 'extension', 'RetryIcon': 'refresh', 'ShieldUserIcon': 'shield_person', 'SendMessageIcon': 'send', 'PhoneCallIcon': 'call', 'VideoIcon': 'videocam', 'ScreenArrowIcon': 'screen_share', 'MoreHorizontalIcon': 'more_horiz', 'MoreVerticalIcon': 'more_vert', 'InboxIcon': 'inbox', 'BookmarkIcon': 'bookmark', 'ReplyIcon': 'reply', 'DenyIcon': 'block', 'AppsIcon': 'apps', 'CameraIcon': 'photo_camera', 'FileIcon': 'draft', 'CheckmarkLargeIcon': 'check', 'CheckmarkSmallIcon': 'check', 'LockIcon': 'lock', 'DownloadIcon': 'download', 'UploadIcon': 'upload', 'ShareIcon': 'share', 'FlagIcon': 'flag', 'UserPlusIcon': 'person_add', 'EmojiIcon': 'mood', } ROOT = pathlib.Path(__file__).resolve().parent.parent OUT = ROOT / 'themes/cookie-glass/assets/icons' CACHE = pathlib.Path.home() / '.cache/valenced/msym' SIZE = 72 # 24dp at 3x URL = 'https://raw.githubusercontent.com/google/material-design-icons/master/symbols/web/{0}/materialsymbolsrounded/{0}_24px.svg' OUT.mkdir(parents=True, exist_ok=True) CACHE.mkdir(parents=True, exist_ok=True) for key, sym in MAP.items(): svg = CACHE / f'{sym}.svg' if not svg.exists(): svg.write_bytes(urllib.request.urlopen(URL.format(sym)).read()) white = svg.read_text().replace(' = ' + json.dumps({k: f'assets/icons/{k}.png' for k in MAP}, indent='\t') + '\n') print(len(MAP), 'icons')