Skip to content

Conversation

@lucasluitjes
Copy link

@lucasluitjes lucasluitjes commented Dec 1, 2025

What kind of change does this PR introduce? (check at least one)

  • Bugfix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Code style update
  • Refactor (refactoring or adding test which isn't a fix or add a feature)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Did you test your solution?

  • I lightly tested it in one browser
  • I deeply tested it in several browsers
  • I wrote tests around it (unit tests, integration tests, E2E tests)

Problem Description

As mentioned in #85, the SVG images are invisible in dark mode. This is because they use a black foreground on a transparent background.

Solution Description

The \bg instruction does not work with SVG in codecogs, but \colorbox does. This PR wraps each expression in a \colorbox. So x = 2kj becomes \colorbox{white}{$x = 2kj$}.

For future reference, I used a sed oneliner to apply this to all instances: sed -i -E 's|\]\(http://latex\.codecogs\.com/svg\.latex\?([^)]*)\)|](http://latex.codecogs.com/svg.latex?%5Ccolorbox%7Bwhite%7D%7B%24\1%24%7D)|g' input.md

Side Effects, Risks, Impact

The margin around the expression is slightly increased (in firefox at least). This fixes the dark mode legibility problem that @mwmwmw reported in #86, but in light mode it just means the margins are slightly bigger.

Using \bg doesn't work, but wrapping the expression in \colorbox
does. For future reference, I used the following sed oneliner:
sed -i -E 's|\]\(http://latex\.codecogs\.com/svg\.latex\?([^)]*)\)|](http://latex.codecogs.com/svg.latex?%5Ccolorbox%7Bwhite%7D%7B%24\1%24%7D)|g' input.md
@lucasluitjes
Copy link
Author

(Description edited to include the PR template and mention the difference between this PR and the other dark mode PR)

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

Successfully merging this pull request may close these issues.

1 participant