Skip to main content

bugs - What is wrong with White Background for a DockedCell?



Bug introduced in V10.4 or earlier and persists through V11.3




SetOptions[
EvaluationNotebook[]
, DockedCells -> Flatten @ {
Cell[
BoxData @ ToBoxes[Framed[InputForm@#, Background -> White]]
, CellFrameMargins -> 15
, CellMargins -> {{0, 0}, {0, 0}}
, Background -> #

] & /@ {
Inherited, Red, GrayLevel[1.], None, GrayLevel[.99], Blue
}}
]

Apparently you can not have White Background for a DockedCells.


And if you do not obey they will take your margins, too!


enter image description here


Any reasonable explanation?


Notice the None case is documented:




If Background->None is set, then the margins are only applied if a CellFrame is present. If the cell frame is not drawn on all sides, then the margin will only be applied to the sides with a frame setting.



V11.2 Win7



[CASE:3975061] was created




Answer




[...] It does appear as though DockedCells cannot have White as their Background specification. I have filed a report with our developers regarding this incorrect limitation so that they may investigate and look to address the issue in a future release. [...]



- WRI Support



The workaround is to use 'almost' white:


SetOptions[EvaluationNotebook[]
, DockedCells -> Cell[
BoxData @ ToBoxes[Framed[InputForm@GrayLevel[.999]]]
, CellFrameMargins -> 15
, CellMargins -> {{0, 0}, {0, 0}}
, Background -> GrayLevel[.999]
]

]

Comments