R.L. Stines's The Haunted School
On the night of the dance, Tommy and his friend Benjamin "Ben" Jackson need to fix a banner. While searching for needed materials, they find an elevator that goes sideways and transports them to a classroom in black and white world, a place where everything is in gray scale (black and white). Here they meet Seth Cortez and his friends, Eddie, Mona, Eloise, and Mary who became a few of the members of the Missing Class of 1947 who have not aged even after all that time. Seth tells them the story of how a photographer named Mr. Chameleon sent them to this colorless world in a "crack" with his camera, during the class photo. Everyone transported to this world gradually loses their colors.
...
Thalia explained to her friends how she opened her tube of lipstick one day and got excited after discovering that it still had color. She hadn't seen colors in so long, she tried to draw on the wall to make colorful pictures. But when her lipstick touched the wall, it made an exit into the real world. Thalia immediately went through it without thinking and the hole instantly closed, before she could go back for the others. She had tried to make another hole but the lipstick was only ordinary in the real world.
Found with a search for classroom elevator sideways "turning grey"