mathjax / mathjax/MathJax

Default Color

Open
#3,190 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Code Example Feature Request
Dominant language
JavaScript
Stars
10.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I need a way to restore the default color after changing it. One may not know the default color conveniently since it comes from CSS.

In LaTeX, we can restore the default color by doing something like:

\colorlet{colordefl}{.} %save current color
\color{red}
%color is red here
\color{colordefl}
%color is default again

However, \colorlet does not seem to be supported in MathJax. The workaround in most cases is to scope any color changes:

% color is default here
{\color{red}
%color is red here
}
% color is default here again

However, this isn't possible for certain constructs. For example, to color an underbrace and its label, but not its contents:

{\color{red}\
underbrace{\color{colordefl} ...}_{...}
}

This is somewhere between a bug report (\colorlet is missing), a feature request (add it, or equivalent mechanism, please), and a question (how do I do this / is there a workaround?).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by tracing MathJax's handling of \color and how LaTeX color macros are supported. Done means providing a documented mechanism to restore the CSS-derived default color where simple scoping is insufficient.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, latex
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.