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

Issue with CSS variables in charts since 1.11.12 #500

Open
mzizka opened this issue Feb 19, 2025 · 2 comments
Open

Issue with CSS variables in charts since 1.11.12 #500

mzizka opened this issue Feb 19, 2025 · 2 comments
Labels

Comments

@mzizka
Copy link

mzizka commented Feb 19, 2025

We use html-to-image to export images of charts created with Recharts.

We use CSS variables to define colors. These used to export fine in 1.11.11, but the color does not export correctly since 1.11.12. There are workarounds obviously, but I wonder why this breaking change was introduced?

Expected Behavior

You can reproduce the expected behavior on CodeSandbox here.

This version uses html-to-image 1.11.11. When clicking the "Export chart" button, the resulting file contains the red and blue colors.

Image

Current Behavior

The unexpected behavior can be tested on CodeSandbox here.

This version of the sample is based on html-to-image 1.11.13. The blue and red colors are lost in the resulting file.

Image

Possible Solution

The obvious workaround is to inject the colors explicitly instead of using CSS variables. We are using MUI so this is easy enough. But CSS vars do have some advantages when switching themes.

Environment

  • html-to-image: 1.11.13
  • OS: MacOS 15.3
  • Browser: Chrome 133
@mzizka mzizka added the bug label Feb 19, 2025
@biiibooo
Copy link
Contributor

biiibooo bot commented Feb 19, 2025

👋 @mzizka

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@mkpanq
Copy link

mkpanq commented Feb 19, 2025

Same issue here. For now, I've decided to lock on 1.11.11 👀

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

No branches or pull requests

2 participants