weixin_39790717
weixin_39790717
2021-01-12 12:54

Interchangable Icons

Feature Request

Currently, the Icons used in flarum is Font Awesome 5 which based on searching through code appears to be hard-coded, now as I understand it beta 8 made using custom icons in groups much better but I still do not see a way that would allow the replacement of core icons. (navigation, editor, etc.)

This features should be part of flarum because it allows some customizability and prevents every flarum install from looking the same as another one. It would also allow extension developers to introduce new ways of implementing icons.

A solution to this problem would be to move the icon packs to an extension as had previously noted back here

The alternative I considered in this post (Iconify) seems to have been a good idea but as luceos pointed out in a comment it would increase the offsite dependency which is not ideal, it seems that making icons an extension is an excellent alternative.

该提问来源于开源项目:flarum/core

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

8条回答

  • weixin_39940714 weixin_39940714 4月前

    can you please mention that extension? Discuss or packagist link would be best.

    点赞 评论 复制链接分享
  • weixin_39790717 weixin_39790717 4月前

    https://discuss.flarum.org/d/21401-icons-by-fajuu is the extension that currently does this.

    点赞 评论 复制链接分享
  • weixin_39613712 weixin_39613712 4月前

    Theoretically replacement of core icons is possible via custom CSS, something like:

    css
    .far.fa-comments {
      font-family: MyCustomIconFont;
      content: "\uXXXX";
    }
    

    Happy to consider any ideas for how de-coupling icons from FontAwesome could work, but I have none myself atm

    点赞 评论 复制链接分享
  • weixin_39940714 weixin_39940714 4月前

    I have heard this same request from clients as well. Especially when they have very strict design systems in place. My solution would be to

    a) extract icons to their own extension b) use locale strings or other type of replacement references (we could even inject into TextFormatter perhaps) for the icon

    Obstruction might be the difference between the sets and how they should be rendered. Span vs svg vs font etc.

    Also FA could potentially work with treeshaking too.

    点赞 评论 复制链接分享
  • weixin_39613712 weixin_39613712 4月前

    I think this will quickly get unnecessarily complicated. Best solution in my eyes is to stick with FontAwesome as the core syntax/icon class names, and then allow extensions to override CSS as per my previous comment, or add their own JS to inject SVGs etc etc. That way we keep core uncomplicated, and extensions just need to "bridge" their own custom icons with FontAwesome syntax, in whatever way they deem appropriate.

    点赞 评论 复制链接分享
  • weixin_39918747 weixin_39918747 4月前

    Using SVG (possibly directly via inlining) could help - we'd need to create a map of all icons and make that overridable for extensions.

    Sounds like quite a lot of work, though.

    点赞 评论 复制链接分享
  • weixin_39875842 weixin_39875842 4月前

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum. In any case, thanks for taking an interest in this software and contributing by opening the issue in the first place!

    点赞 评论 复制链接分享
  • weixin_39790717 weixin_39790717 4月前

    I'm going to close this ticket, an extension has been created that takes care of this issue.

    点赞 评论 复制链接分享

相关推荐