setAssignedColor method

  1. @override
void setAssignedColor(
  1. int selector,
  2. int foreground,
  3. int background
)
override

Implementation

@override
void setAssignedColor(int selector, int foreground, int background) {
  if (selector < 1 || selector > 2) return;
  if (!_isDecColor(foreground) || !_isDecColor(background)) return;

  final previous = _assignedColors[selector];
  _assignedColors[selector] = (
    foreground: foreground,
    background: background,
  );

  if (selector != 1) return;
  if (_matchesAssignedColor(_cursorStyle.foreground, previous?.foreground)) {
    _cursorStyle.foreground = _namedColor(foreground);
  }
  if (_matchesAssignedColor(_cursorStyle.background, previous?.background)) {
    _cursorStyle.background = _namedColor(background);
  }
}