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

only adjust black color during box operations #2456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dginev
Copy link
Collaborator

@dginev dginev commented Dec 23, 2024

Fixes #2455 .

The issue is really excellent in scope and triage - I added the test case here as well.

That said, the resolution is just a little tricky, because I am not sure if there is a clear design for testing "a color having been set". I tried a couple of generic solutions, but kept losing test coverage. Then I saw we are using a Black->equals test to assert the default color scheme. As it turns out, using that test keeps all tests passing and also covers the reported example.

But I can't at all claim that I am certain this is the best approach.

@dginev dginev requested a review from brucemiller December 23, 2024 19:37
@brucemiller
Copy link
Owner

Hmm, you're right: being black doesn't mean that it wasn't explicitly set to black. I want to look a bit more...

@xworld21
Copy link
Contributor

Hmm, you're right: being black doesn't mean that it wasn't explicitly set to black. I want to look a bit more...

There are a few packages that use Black (as opposed to ['rgb', 0, 0, 0] which is different). Grepping for Black brings up:

  • diagbox: Black is used as default linecolor
  • color/xcolor: use Black as default or if parsing/lookup fails
  • framed/makecell/ntheorem: use Black as framecolor
  • LaTeX.pool: uses Black as default color and as fill/stroke for \circle;
  • xy: uses Black as default color
  • wasysym: uses Black as background
  • Package.pm: uses Black if color lookup fail

So it seems safe to interpret Black as 'currentColor' (in SVG terminology); if TeX code explicitly sets the color to black, it will actually use ['rgb', 0, 0, 0]. With that in mind, it should really be called CurrentColor instead of Black (which would lead to a fix for #1541, by the way).

If anything, adjustBoxColor may have to adjust all other occurrences of Black too (linecolor, framecolor, background, fill, stroke) depending on how the normal TeX engines behave.

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.

color from surrounding scope overrides colors inside boxes
3 participants