square_color method

String? square_color(
  1. dynamic square
)

Returns the color of the square ('light' or 'dark'), or null if square is invalid

Implementation

String? square_color(square) {
  if (SQUARES.containsKey(square)) {
    final sq_0x88 = SQUARES[square];
    return ((rank(sq_0x88) + file(sq_0x88)) % 2 == 0) ? 'light' : 'dark';
  }

  return null;
}