Project icons / images organization

  softwareengineering

I am asking a question about the overall architecture between different projects.

Let’s say I want to centralize all icons / images between different projects in a single repository. This means that all projects need to checkout / synchronize with this repository.

I am going to use SVG graphics to make sure that I can dynamically change colors in the source code of my projects. The changing of colors is mandatory and is depending of project + domain logic.

What are advantages / disadvantages of this approach (single repo + SVG graphics)?

The first things which pops into my mind are:

Advantages:

  • single source of truth
  • easy update of all projects
  • decreased repository sizes

Disadvantages:

  • coupling of not dependent projects via a repo
  • potentially complex logic to modify SVG properties (depends on the SVG itself)
  • strong coupling between the images and the projects (the code needs to know the implementation details, in order to change the colors)

Does any body has experience with this approach? What do you think?

3

For web applications, consider a third approach:

  1. Keep the SVG images in one place. Those images won’t change from project to project.

  2. Apply color changes to SVG images within a specific site through CSS.

This way, you don’t need any “complex logic to modify SVG properties” and you don’t couple images with projects.

For native applications, the component which displays the SVG images may provide a way to change the elements. If this is the case, use it to change the colors on the fly, based on their CSS classes.

If the component doesn’t let you change a displayed element, you may consider modifying the SVG code itself on the fly before passing it to the component which would display the image. The idea is the same: go through the XML, find the classes, tamper with the XML itself to set the colors. Not the most elegant approach, but it works.

3

LEAVE A COMMENT