Make isSameColor cave-insensitive. Closes #1272