This is fixed in librsvg version 2.47.3 and later librsvg versions.
Option 1:
Enhance the [[File:]] syntax with "color=" attribute to allow to recolor the source SVG (typically B&W) to enable on-fly generating of the same image but in different color without necessity to reupload the new file.
Positives:
- Reducing the duplication of same files differing only by color.
- More user friendly - no need to work with the file anymore.
The generated file will be stored then like:
<server>/path/to/thumb/<hash1>/<hash2>/<filename>/<size>px_<4colorhexRGBA>-<filename>.png
So for instance for green File:AddSpeechbubble icon.svg it will be
[[File:AddSpeechbubble icon.svg|240px|color=#0f0|Icon]]
https://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/AddSpeechbubble_icon.svg/240px_00ff0000-AddSpeechbubble_icon.svg.png
Complications:
- tinting ability might need to be added to thumbor for Wikimedia production usage
- as with size, page, etc this can create a large number of derivative files that need to be cleared on modification, but this should work with existing support
- tinting/coloring alone might not be enough, we might need other features...
- might be an extra complication to support that extra parameter in front-end tools
Option 2:
Create a more general "derivative files" concept allowing 'virtual' modified files to be created from on-wiki sources, such as with a color tint (among other possibilities outside the narrow scope here). The derivative file can then be used with a direct [[File:]] usage as if it were any other file.
Complications:
- need a UI for generating derivative files and saving them into the system
- probably want an API for that too!
- how many modification features to support? complexity/usability/safety concerns
- thumbor considerations:
- if MediaWiki generates the derivative master, then thumbor only needs to handle the thumbnails from a master, perhaps?
- or do all derivation through thumbor, more complex
- would URL structure of the generated files look the same as those with raw sources? If so, should work well with existing front-end tools?
Option 3
Add an explicit way to mark derivative files, with the implementation of tinting/cropping/etc left to extensions or bot tools for now. (cf DerivativeFX)
Option 4
Let templates/lua modules generate SVG (sanitized for safety) and leave templating/tinting/etc to those templates to deal with. Also usable for graphics and things (compare with https://en.wikipedia.org/wiki/Module:Chart HTML charts!)