def nearest_term_256(byte)
      for i in 0..4
        lower, upper = BYTEPOINTS_256[i], BYTEPOINTS_256[i + 1]
        next unless byte.between?(lower, upper)

        distance_from_lower = (lower - byte).abs
        distance_from_upper = (upper - byte).abs
        closest = distance_from_lower < distance_from_upper ? lower : upper
      end
      closest
    end
def nearest_term_256(byte)
      for i in 0..4
        lower, upper = BYTEPOINTS_256[i], BYTEPOINTS_256[i + 1]
        next unless byte.between?(lower, upper)

        distance_from_lower = (lower - byte).abs
        distance_from_upper = (upper - byte).abs
        closest = distance_from_lower < distance_from_upper ? lower : upper
      end
      closest
    end
Approximates the given +byte+ to a terminal colour value within range of
 256 colours.

 @param [Integer] byte a number between 0 and 255
 @return [Integer] approximated number