-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Support currentColor foreground #214
Comments
Could you elaborate a bit on what you consider the foreground color? When converting a simple DVI file that doesn't change colors, the SVG doesn't contain any color attributes either. The fill color defaults to black then and there's no stroke color set, i.e. outlines are not drawn. In this case it's easy to add a However, if there are color values present in the SVG, these colors were explicitly set in the input file. A At the moment, I'm not sure about the intended semantics of |
Hm, these are quite specific prerequisites. I can't see a reliable way to determine the "dominant color" because the DVI file can contain several subsequent and nested color specials that might affect none or different parts of the document. Only in case of simple input files it's easy to detect it. \special{dvisvgm:currentcolor} |
That approach sounds potentially promising. I'm imagining that when |
Yes, |
It would be good to hear more on this being implemented 😉. That sounds like it should work well to me, I've just got two questions: Would the design you're thinking of work if hypothetically the colour was changed and a second If no colour is set (i.e. it's the default black), could just the |
I'm still playing around with several semantics of the special statement to find out the most plausible variant. Unfortunately, it's more complicated than I first thought. I don't think option Anyway, I'm currently preparing to move to a different city alongside my job and therefore don't have much time to work on dvisvgm. So please don't expect this to be implemented in the next few weeks. |
I finally found some time to add a first implementation which is also part of the latest release 3.1.
|
It's been a while, but I just wanted to come back and say this has been working brilliantly. Thanks for adding this functionality! |
That's great to hear. Thank you for the feedback! |
Thank you for this! We're seeing significant improvements in Emacs' preview rendering experience, since we don't have to reopen each svg and replace colors manually.
|
SVGs support the wonderful color value
currentColor
. This is particularly useful in some situations, such as the LaTeX previews via dvisvgm functionality I am currently working on, where I want the images to dynamically adapt to theme changes.theme-changing-currentColor.mp4
For this use case, having a transparent background and
currentColor
foreground is ideal.Currently, I achieve this result by taking the result of dvisvgm, finding the first color in the SVG file, and replacing all instances of that color with
currentColor
. This is an imperfect solution though (with issues like #212 complicating the process), and I imagine this isn't the only use case that would benefit from currentColor support.With this in mind, it would be rather nice if dvisvgm supported a
--currentcolor
flag (or similar) to get an SVG wherecurrentColor
is used for the foreground OOTB.The text was updated successfully, but these errors were encountered: