setAttributes method
void
setAttributes(})
Sets the cell attributes at (x, y). Does nothing if coordinates are out of bounds.
Implementation
void setAttributes(
int x,
int y, {
String? char,
int? fg,
int? bg,
int? modifiers,
int? underlineColor,
String? uri,
bool? blend,
}) {
if (!isCellValid(x, y)) return;
final useBlend = blend ?? defaultBlend;
final charIdx = y * width + x;
final isWide = char != null && char != '' && isWideGrapheme(char);
if (char != null) {
if (char != '') _resetOverwrittenWideAt(x, charIdx);
characters[charIdx] = char;
if (isWide && x + 1 < width) _placeWideContinuationAt(x, charIdx);
}
_writeCellAttributes(
charIdx * 3,
fg: fg,
bg: bg,
modifiers: modifiers,
underlineColor: underlineColor,
uri: uri,
blend: useBlend,
);
if (isWide && x + 1 < width) {
_writeCellAttributes(
(charIdx + 1) * 3,
fg: fg,
bg: bg,
modifiers: modifiers,
underlineColor: underlineColor,
uri: uri,
blend: useBlend,
);
}
}