Add Remix Icon themes

This commit is contained in:
Veronica Berglyd Olsen
2025-01-10 18:49:23 +01:00
parent 586370188b
commit fbcf185c13
7 changed files with 388 additions and 16 deletions
+53 -13
View File
@@ -27,10 +27,7 @@ from pathlib import Path
from xml.etree import ElementTree as ET
UTILS = Path(__file__).parent
ET.register_namespace("", "http://www.w3.org/2000/svg")
MATERIAL_REPO = "https://github.com/google/material-design-icons.git"
FONT_AWESOME_REPO = "https://github.com/FortAwesome/Font-Awesome.git"
ICONS = [
"alert_error",
"alert_info",
@@ -81,15 +78,16 @@ ICONS = [
"unfold-hide",
"unfold-show",
"sb_project",
"sb_novel",
"sb_search",
"sb_outline",
"sb_build",
"sb_novel",
"sb_outline",
"sb_project",
"sb_search",
"add",
"bookmarks",
"browse",
"build_settings",
"cancel",
"checked",
"chevron_down",
@@ -112,7 +110,6 @@ ICONS = [
"language",
"lines",
"list",
"manuscript",
"margin_bottom",
"margin_left",
"margin_right",
@@ -194,7 +191,7 @@ def _cloneRepo(repoPath: Path, repoUrl: str) -> None:
def processMaterialIcons(workDir: Path, iconsDir: Path, jobs: dict) -> None:
"""Process material icons of a given spec and write output file."""
srcRepo = workDir / "material-design-icons"
_cloneRepo(srcRepo, MATERIAL_REPO)
_cloneRepo(srcRepo, "https://github.com/google/material-design-icons.git")
for file, job in jobs.items():
name: str = job["name"]
@@ -211,10 +208,10 @@ def processMaterialIcons(workDir: Path, iconsDir: Path, jobs: dict) -> None:
iconSrc = srcRepo / "symbols" / "web"
for key, icon in _loadMap("material_symbols").items():
if kind:
fileNmae = f"{icon}_{kind}_24px.svg"
fileName = f"{icon}_{kind}_24px.svg"
else:
fileNmae = f"{icon}_24px.svg"
iconFile = iconSrc / icon / f"materialsymbols{style}" / fileNmae
fileName = f"{icon}_24px.svg"
iconFile = iconSrc / icon / f"materialsymbols{style}" / fileName
if iconFile.is_file():
icons[key] = ET.fromstring(iconFile.read_text(encoding="utf-8"))
else:
@@ -231,7 +228,7 @@ def processMaterialIcons(workDir: Path, iconsDir: Path, jobs: dict) -> None:
def processFontAwesome(workDir: Path, iconsDir: Path, jobs: dict) -> None:
"""Process Font Awesome icons of a given spec and write output file."""
srcRepo = workDir / "Font-Awesome"
_cloneRepo(srcRepo, FONT_AWESOME_REPO)
_cloneRepo(srcRepo, "https://github.com/FortAwesome/Font-Awesome.git")
for file, job in jobs.items():
name: str = job["name"]
@@ -271,3 +268,46 @@ def processFontAwesome(workDir: Path, iconsDir: Path, jobs: dict) -> None:
print("")
return
def processRemix(workDir: Path, iconsDir: Path, jobs: dict) -> None:
"""Process Remix icons of a given spec and write output file."""
srcRepo = workDir / "RemixIcon"
_cloneRepo(srcRepo, "https://github.com/Remix-Design/RemixIcon.git")
for file, job in jobs.items():
name: str = job["name"]
style = "fill" if job["filled"] else "line"
print(f"Processing: {name}")
icons: dict[str, ET.Element] = {}
iconSrc = srcRepo / "icons"
iconGroups = [x for x in iconSrc.iterdir() if x.is_dir()]
for key, icon in _loadMap("remix").items():
if icon.endswith(("-line", "-fill")):
fileName = f"{icon}.svg"
else:
fileName = f"{icon}-{style}.svg"
for group in iconGroups:
iconFile = group / fileName
if iconFile.is_file():
break
else:
fileName = f"{icon}.svg"
for group in iconGroups:
iconFile = group / fileName
if iconFile.is_file():
break
else:
print(f"Not Found: {fileName}")
continue
icons[key] = ET.fromstring(iconFile.read_text(encoding="utf-8"))
target = iconsDir / f"{file}.icons"
_writeThemeFile(target, name, "Remix Icon", "Apache 2.0", icons)
print("")
return
+108
View File
@@ -0,0 +1,108 @@
{
"alert_error": "error-warning",
"alert_info": "information",
"alert_question": "question",
"alert_warn": "alarm-warning",
"cls_archive": "archive",
"cls_character": "group",
"cls_custom": "price-tag-3",
"cls_entity": "building",
"cls_none": "checkbox-blank",
"cls_novel": "git-repository",
"cls_object": "key-2",
"cls_plot": "puzzle-2",
"cls_template": "folder-add",
"cls_timeline": "hourglass",
"cls_trash": "delete-bin",
"cls_world": "earth",
"prj_folder": "folder-6",
"prj_document": "file-text",
"prj_title": "file-text",
"prj_chapter": "file-text",
"prj_scene": "file-text",
"prj_note": "file-4",
"fmt_bold": "bold",
"fmt_italic": "italic",
"fmt_mark": "mark-pen",
"fmt_strike": "strikethrough",
"fmt_subscript": "subscript",
"fmt_superscript": "superscript",
"fmt_underline": "underline",
"fmt_toolbar": "font-color",
"search": "search-line",
"search_cancel": "close",
"search_case": "font-size",
"search_loop": "loop-right",
"search_preserve": "font-size-2",
"search_project": "file-search",
"search_regex": "asterisk",
"search_replace": "find-replace-line",
"search_word": "space",
"bullet-off": "checkbox-blank-circle-line",
"bullet-on": "checkbox-blank-circle-fill",
"unfold-hide": "arrow-right-s-fill",
"unfold-show": "arrow-down-s-fill",
"sb_build": "stack",
"sb_novel": "booklet",
"sb_outline": "table-view",
"sb_project": "file-edit",
"sb_search": "file-search",
"add": "add",
"bookmarks": "bookmark",
"browse": "folder-2",
"build_settings": "file-settings",
"cancel": "prohibited-2",
"checked": "checkbox",
"chevron_down": "arrow-down-s-line",
"chevron_left": "arrow-left-s-line",
"chevron_right": "arrow-right-s-line",
"chevron_up": "arrow-up-s-line",
"close": "close-large",
"copy": "file-copy",
"document_add": "file-add",
"document": "file-text",
"edit": "edit",
"exclude": "close-circle",
"export": "export",
"filter": "filter-2",
"fit_height": "expand-height-line",
"fit_width": "expand-width-line",
"folder": "folder-6",
"font": "font-sans",
"import": "import",
"language": "translate-2",
"lines": "menu-2",
"list": "list-unordered",
"margin_bottom": "skip-down-line",
"margin_left": "skip-left-line",
"margin_right": "skip-right-line",
"margin_top": "skip-up-line",
"maximise": "fullscreen",
"minimise": "fullscreen-exit",
"more_arrow": "arrow-right-s-fill",
"more_vertical": "more-2",
"noncheckable": "checkbox-indeterminate",
"open": "file-upload",
"panel": "layout-bottom",
"pin": "pushpin",
"project_copy": "",
"quote": "double-quotes-l",
"refresh": "refresh-line",
"remove": "subtract",
"revert": "reset-left",
"settings": "settings-2",
"star": "star-fill",
"stats": "numbers",
"text": "file-text",
"timer_off": "pause",
"timer": "timer",
"unchecked": "checkbox-blank",
"view": "eye-fill"
}