The grid (core) ยท console.warn
a scale's "mid" needs an odd number of colours (a middle stop to pin); {n} were given, so "mid" was ignored.
Printed by The grid (core), prefixed [lattice], since 1.68.2.
Warnings reference › formatting.scale.mid.even
- Identifier
formatting.scale.mid.even- Raised by
- The grid (core)
- Since
- 1.68.2
What happened
mid pins the middle colour stop of a colour scale to a particular value, and with an even number of colours there is no middle stop to pin. The setting is ignored and the stops are spread evenly, so a diverging scale will not be centred where you asked.
The fix
Give the scale an odd number of colours - three is the usual diverging scale - or drop mid.
The smallest fix
rules: [{ scale: { colours: ['#c00', '#eee', '#080'], mid: 0 } }]
Reference
Covered in full at the API reference.