HeaderBackground

HeaderBackground

is an option for Dataset that specifies what background color to use for row and column headers.

Details

  • The setting for HeaderBackground can be any color or opacity specification, or a pure function returning the same.
  • With the option HeaderBackgroundcolor, the specified color will be used as a background for all headers in the dataset.
  • HeaderBackgroundNone specifies that no background should be used, so that in effect the background is transparent.
  • HeaderBackgroundAutomatic specifies a background that follows the system appearance for headers.
  • The settings for HeaderBackground can be given as follows to apply separately to different items:
  • specapply spec to all headers
    {spec1,spec2,,specn}apply speck to headers at Dataset level k
    {spec_(1),spec_(2),...,spec_(n), rules}also allow explicit rules for individual headers
  • The speck can have the following forms:
  • {s1,s2,,sn}use s1 through sn; then use defaults
    {{c}}use c in all cases
    {{c1,c2}}alternate between c1 and c2
    {{c1,c2,}}cycle through all ci
    {s,{c}}use s, then repeatedly use c
    {s1,{c},sn}use s1, then repeatedly use c, but use sn at the end
    {s1,s2,,{c1,c2,},sm,,sn} use the first sequence of si at the beginning, then cyclically use the ci, then use the last sequence of si at the end
    {s1,s2,,{},sm,,sn}use the first sequence of si at the beginning and the last sequence at the end
  • Rules have the form ispec, where i specifies a position in the dataset.
  • Positions can be patterns.
  • The position of a header can be read at the bottom of a dataset when you hover over the header.
  • If the left-hand side of a rule is not a list, the setting is applied to any position that contains the left-hand side as a key or index.
  • A pure function f that returns a color can be used in place of any color. The setting is given by f[item,position,data], where data is the dataset's first argument.

Examples

open allclose all

Basic Examples  (3)

Make all headers pink:

Make headers at successive levels different colors:

Color individual headers:

Generalizations & Extensions  (3)

Color all headers that have a given name:

Use a pattern in a position:

Obtain the header color from a function applied to the header value:

Possible Issues  (2)

The blank header at the intersection of a header row and a header column is a column header, and takes on the color specified for columns:

Specify the color of the blank header explicitly using the position shown underneath the Dataset output when you hover over the upper-left corner of the header:

Cyclic color specifications are applied to row headers starting with the first labeled row:

Cyclic color specifications are applied to column headers starting with the blank header, if it is present:

To start cyclic column header colors with the first labeled header when a blank header is present, specify an initial color of Automatic:

Wolfram Research (2020), HeaderBackground, Wolfram Language function, https://reference.wolfram.com/language/ref/HeaderBackground.html.

Text

Wolfram Research (2020), HeaderBackground, Wolfram Language function, https://reference.wolfram.com/language/ref/HeaderBackground.html.

CMS

Wolfram Language. 2020. "HeaderBackground." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HeaderBackground.html.

APA

Wolfram Language. (2020). HeaderBackground. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HeaderBackground.html

BibTeX

@misc{reference.wolfram_2024_headerbackground, author="Wolfram Research", title="{HeaderBackground}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/HeaderBackground.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_headerbackground, organization={Wolfram Research}, title={HeaderBackground}, year={2020}, url={https://reference.wolfram.com/language/ref/HeaderBackground.html}, note=[Accessed: 22-November-2024 ]}