[GH-ISSUE #741] Broken icon image when using a theme that alters icon colors #460

Closed
opened 2026-02-25 21:35:05 +03:00 by kerem · 2 comments
Owner

Originally created by @jasonmunro on GitHub (Aug 9, 2023).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/741

🐛 Bugreport

I noticed this on mobile with a dark theme. The "three dots" icon above a message list is not displaying correctly.

Version & Environment

Rev: current master

OS: NA

Steps to reproduce

  1. change to one of the dark themes
  2. open a message list on mobile
  3. observe the broken icon in the upper right of the page
  4. ...
  5. Profit

Themes can modify icon colors, which happens here: https://github.com/cypht-org/cypht/blob/master/modules/themes/modules.php#L193 This code adds a "fill" attribute to the svg tag. However there MUST be a space at the end of the svg tag before the closing characters, otherwise the fill attribute is not correctly formatted. For example:

<svg path="..." />

this is ok, there is a space before the tag closes

<svg path="..."/>

This is not ok, there is no space before the tag closes. Without the space adding the fill attribute causes the path and fill attributes to not have a space separating them which is invalid.

Originally created by @jasonmunro on GitHub (Aug 9, 2023). Original GitHub issue: https://github.com/cypht-org/cypht/issues/741 ## 🐛 Bugreport <!-- Describe your issue in detail. Include screenshots if needed. Give us as much information as possible. --> I noticed this on mobile with a dark theme. The "three dots" icon above a message list is not displaying correctly. ### Version & Environment <!-- Paste Git-Commit ID or Tag-Name here --> Rev: current master <!-- Specify your OS and OS Version here if the issue is (most likely) platform dependent. --> OS: NA ### Steps to reproduce 1. change to one of the dark themes 2. open a message list on mobile 3. observe the broken icon in the upper right of the page 4. ... 5. Profit Themes can modify icon colors, which happens here: https://github.com/cypht-org/cypht/blob/master/modules/themes/modules.php#L193 This code adds a "fill" attribute to the svg tag. However there MUST be a space at the end of the svg tag before the closing characters, otherwise the fill attribute is not correctly formatted. For example: ```<svg path="..." />``` this is ok, there is a space before the tag closes ```<svg path="..."/>``` This is not ok, there is no space before the tag closes. Without the space adding the fill attribute causes the path and fill attributes to not have a space separating them which is invalid.
kerem closed this issue 2026-02-25 21:35:05 +03:00
Author
Owner

@jasonmunro commented on GitHub (Aug 9, 2023):

an easy fix for this would be to pad the fill attribute with a space when doing the string replace. In the themes modules just change this:

Hm_Image_Sources::$$name = $pre.rawurlencode(str_replace('/>', 'fill="'.$color.'" />', $img));

to this:

Hm_Image_Sources::$$name = $pre.rawurlencode(str_replace('/>', ' fill="'.$color.'" />', $img));

<!-- gh-comment-id:1671630648 --> @jasonmunro commented on GitHub (Aug 9, 2023): an easy fix for this would be to pad the fill attribute with a space when doing the string replace. In the themes modules just change this: ```Hm_Image_Sources::$$name = $pre.rawurlencode(str_replace('/>', 'fill="'.$color.'" />', $img));``` to this: ```Hm_Image_Sources::$$name = $pre.rawurlencode(str_replace('/>', ' fill="'.$color.'" />', $img));```
Author
Owner

@marclaporte commented on GitHub (Aug 9, 2023):

Thank you @jasonmunro

This is a good first commit for one of our new devs.

<!-- gh-comment-id:1672215613 --> @marclaporte commented on GitHub (Aug 9, 2023): Thank you @jasonmunro This is a good first commit for one of our new devs.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#460
No description provided.