Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken icon image when using a theme that alters icon colors #741

Closed
jasonmunro opened this issue Aug 9, 2023 · 2 comments
Closed

Broken icon image when using a theme that alters icon colors #741

jasonmunro opened this issue Aug 9, 2023 · 2 comments

Comments

@jasonmunro
Copy link
Member

🐛 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.

@jasonmunro
Copy link
Member Author

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));

@marclaporte
Copy link
Member

Thank you @jasonmunro

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants