pen method
Registers pen and returns its id (stable for the table's lifetime).
Implementation
int pen(Pen pen) {
final existing = _penIds[pen];
if (existing != null) {
return existing;
}
final id = _pens.length;
_pens.add(pen);
_penIds[pen] = id;
if (id == _penOpaque.length) {
_penOpaque = _grow(_penOpaque);
}
_penOpaque[id] =
pen.fg != null &&
pen.bg != null &&
pen.fgAlpha == 255 &&
pen.bgAlpha == 255
? style(
fg: pen.fg!,
bg: pen.bg!,
attrs: pen.attrs,
underlineColor: pen.underlineColor,
link: pen.link,
).value
: StyleId.none.value;
return id;
}