# RowColor

Auto-generated from the config schema in the source. See the [config guide](https://jbrowse.org/jb2/docs/config_guide) for concepts. Built into JBrowse core. [View source](https://github.com/GMOD/jbrowse-components/blob/main/packages/display-kit/src/rowColorConfigSchema.ts).

`scale.unknown: ''` colors no row but those `rows.colors` pins: the "None"
of the Color rows by menu and dialog.

`rows.color`, the row displays' rows colored by an attribute: one ordinal
color channel on the row axis. `field` names the row attribute whose values
take the colors, a samplesTsv column or a subtrack's group, and
`scale.domain` and `scale.range` pair its values with CSS colors, the rest
each taking a palette color. Under `name`, the default, each row is its
own value: the palette (`scale.range`, then the row palette) deals one
color per row, and only where the rows share one panel, a wiggle overlay,
since stacked rows are identified by their labels; `scale.unknown` is the
color every row takes instead, `''` for none. A color pinned on one row is
`rows.colors`, which wins over this, so under `name` this takes no
`scale.domain`. A string is the field.

Each display paints a row's color on the element that identifies a row: the
quantitative display's plot, or the tint beside its label while a score
gradient paints; the multi-row feature display's blocks; the variant
display's label tint; the MAF display's label tint, over the adapter's
`samples[].color`; the mark display's label tint, over a listed source's
color. Not `encoding.color`, which on wiggle and the mark display paints by
value.

## Example usage

```js
{ type: 'LinearVariantDisplay', rows: { color: 'population' } }
```

```js
{
  type: 'LinearVariantDisplay',
  rows: {
    color: {
      field: 'population',
      scale: { domain: ['EUR', 'AFR'], range: ['#1f77b4', '#ff7f0e'] },
    },
  },
}
```

```js
{
  type: 'LinearMultiRowFeatureDisplay',
  rows: { color: { scale: { unknown: '' } }, colors: { mom: '#b2182b' } },
}
```

## Config slots

A setting written to it replaces it whole: a member left out returns to its default. Slot types (`fileLocation`, `frozen`, ...) are explained in the [config slot types reference](https://jbrowse.org/jb2/docs/config_guides/slot_types). Slots a base configuration contributes are listed here too, so this table is the whole surface.

| Slot | Description |
| --- | --- |
| **scale.unknown**<br>[`maybeColor`](https://jbrowse.org/jb2/docs/config_guides/slot_types#the-maybe-types) | The color every row the scale leaves out takes; `''` for none. |
| **field**<br>[`string`](https://jbrowse.org/jb2/docs/config_guides/slot_types#string) = <code>'name'</code> | The row attribute whose values take the colors, or `name`, each row its own value. Under `name` with no `scale.unknown`, stacked rows keep only a file's own colors and the colors `rows.colors` pins, since the palette deals only where the rows share one panel. |
| **scale**<br>[RowColorScale sub-schema](#slot-scaleunknown) | Which color each value of the field takes. Under `name` it takes no `domain`: a row's own color is `rows.colors`. |
| **scale.domain**<br><code>"the field's values that get a color, in order; none under name, where a row's own color is rows.colors"</code> | The field's values that get a color, in order; none under `name`. |
| **scale.range**<br><code>'"" colors no row but those rows.colors pins: the menu\'s None. A color: every row the scale leaves out takes it. Unset: under name the palette deals a color per row where the rows share one panel, and under an attribute each value deals the next palette color; a row left without one keeps the color its file gives it'</code> | The CSS color each value in `domain` takes, in the same order; past them, the palette the other values deal from. |

