only adjust black color during box operations
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.
Hmm, you're right: being black doesn't mean that it wasn't explicitly set to black. I want to look a bit more...
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:
Blackis used as default linecolor - color/xcolor: use
Blackas default or if parsing/lookup fails - framed/makecell/ntheorem: use
Blackas framecolor - LaTeX.pool: uses
Blackas default color and as fill/stroke for\circle; - xy: uses
Blackas default color - wasysym: uses
Blackas background - Package.pm: uses
Blackif 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.