Made gray-related functions noexcept.