Skip to content

Add support for external icon libraries#969

Draft
arnaudvergnet wants to merge 5 commits intomasterfrom
icons-external
Draft

Add support for external icon libraries#969
arnaudvergnet wants to merge 5 commits intomasterfrom
icons-external

Conversation

@arnaudvergnet
Copy link
Contributor

@arnaudvergnet arnaudvergnet commented Oct 15, 2025

Based on #948. Only the last 2 commits are from this PR.

Adds a new script icon_libraries.py inside of a tools directory. This script allows users to clone an icon library such as https://pictogrammers.com/library/mdi/ inside of a static files directory in the backend. The frontend will then be able to fetch those icons without any change in the schema.

The script takes a single argument telling it which icon library to clone. For now only mdi is supported.

Example usage:

python tools/icon_libraries.py --library mdi

This script can also be invoked from the Makefile to generate all known libraries:

make icon-libraries

The script executes the following steps for MDI:

  • The git repository containing the icons is cloned into the /tmp/mdi directory
  • Each SVG icon is converted to png and copied to public/media/icon-libraries/mdi using cairosvg
  • The file meta.json from the repo is adapted to create the file public/media/icon-libraries/mdi/icons.json, listing all available icons, their possible aliases and tags (to implement a nice search feature in the frontend)
  • Once all the icons are copied, the file public/media/icon-libraries/index.json is updated/created to list all available icon libraries, listing their internal id and display name.

This script was designed with adding support for new icon libraries in mind.

The last commit updates the Django schema to add a new source property in the StyleImage model. This property will be used by the frontend to save from which icon library it was originally from.

@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.91%. Comparing base (f9eda11) to head (417b18f).
⚠️ Report is 38 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #969      +/-   ##
===========================================
- Coverage    95.93%   95.91%   -0.02%     
===========================================
  Files           85       85              
  Lines         3910     3892      -18     
===========================================
- Hits          3751     3733      -18     
  Misses         159      159              
Flag Coverage Δ
backend-unittests 95.91% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant