Page MenuHomePhabricator

ResourceLoaderImage should change SVG color to that set by defaultColor
Closed, InvalidPublic


I'm trying to create an oojs-ui theme based off wikimediaui theme. However, currently [[ | ResourceLoaderImage ]] generates SVGs wihout a base color. Setting defaultColor explicitly with a different color should change the color of generated SVGs even if other variants are defined. One use case of this is that it allows theme developers to reuse images from wikimediaui for use in dark themed MediaWiki skins.

Steps to reproduce if this is a bug:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 10 2019, 5:03 AM

Change 483659 had a related patch set uploaded (by VolkerE; owner: VolkerE):
[oojs/ui@master] [DNM] Example of default icon color changed

Daegontaven added a comment.EditedJan 14 2019, 4:56 AM

This may not be an issue isolated to oojs-ui (partly because it's not implemented). I can reproduce this in Echo as well when adding a defaultColor ResourceLoaderImageModule parameter in extension.json or in it's associated JSON file for images.

Change 484286 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/core@master] [DO NOT MERGE] Test for T213373

Change 484286 abandoned by Bartosz Dziewoński:
[DO NOT MERGE] Test for T213373

Can you explain exactly what you're doing that does not work? (E.g. copy-paste a diff)

I just tried this and it works as expected:

Note that MediaWiki has its own code for colorizing icons (ResourceLoaderImageModule and ResourceLoaderImage), and the standalone OOUI library has its own (colorize-svg.js) which is not used by MediaWiki. The former currently supports "defaultColor", the latter does not.

Change 484331 had a related patch set uploaded (by Daegontaven; owner: Daegontaven):
[mediawiki/extensions/Echo@master] [DO NOT MERGE] Example for Echo bug in T213373

Change 484331 abandoned by Daegontaven:
[DO NOT MERGE] Example for Echo bug in T213373

I don't know where the icons defined in badgeicons.json in Echo are actually used, but the icons in the personal bar are defined in regular CSS in modules/nojs/mw.echo.badge.less. You should be able to override them instead by using$wgResourceModuleSkinStyles to set styles for the module ext.echo.styles.badge.

Daegontaven closed this task as Resolved.Jan 15 2019, 2:02 AM
Daegontaven claimed this task.

I see, I was under the assumption this was defined using the badgeicons.json file and being use by the theme via ResourceLoadeImageModule since it was defined in extension.json. My mistake. Closing this!

matmarex changed the task status from Resolved to Invalid.Jan 15 2019, 2:07 AM

That would honestly make sense… I don't know why it's done the way it is. It took me a while to figure it out too. Glad I could help!

Change 483659 abandoned by VolkerE:
[DNM] Example of default icon color changed

Was only meant for showcasing