Adds kd-tree nearest-neighbor search for closest terminal color