handle method

bool handle(
  1. Msg msg
)

Updates cached values from a terminal color report.

Returns true when msg affected the cache.

Implementation

bool handle(Msg msg) {
  switch (msg) {
    case ForegroundColorMsg(:final hex):
      _foregroundHex = hex;
      return true;
    case BackgroundColorMsg(:final hex):
      _backgroundHex = hex;
      return true;
    case CursorColorMsg(:final hex):
      _cursorHex = hex;
      return true;
    case ColorPaletteMsg(:final index, :final hex):
      _palette[index] = hex;
      return true;
    default:
      return false;
  }
}