How to make something like using x4

Hello everyone, what is the best way to make gradient like this picture? I tried to use mesh gradient but have problem to make the solid edge between each gradient block shown in the pic..... also is there anyway to convert the mesh grid to outline? 

Thanks!