Implement a no-dark-mode component. (mathjax/MathJax#3502) #1422
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR creates a new
ui/no-dark-modecomponent that removes the dark-mode colors for MathJax (other than for the menu, which doesn't hook into theMathJax._variable, and so doesn't have a reasonable way to alter the styles).There are a number of files that set up dark-mode colors, and they are in various different extensions. This component works by first checking if the extension is already loaded, and modifying the needed styles if so, otherwise it sets up a loader configuration parameter for code that runs when the extension loads, and removes the styles at that point. The data needed to do this is stored in an array (giving the
MathJax._location to check for the extension being loaded, the name of the extension if not, and the code to run to remove the styles). The explorer adjustment also hooks into the startup handler processing in order to remove some styles, since they are in a mixing that can't be adjusted directly.This component only works within the MathJax Components framework, so can't be used with direct module access (as the
MathJax._variable is not available there). If support for this in server-side processing is needed, we can address that as the need arrises.Resolves issue mathjax/MathJax#3502.