update the gray pattern