Project Settings - Environment - Default Clear Color
Specially for 3D, you can create a world environment, set property Background - Sky - Sky Material = PanoramaSkyMaterial
Then set property PanoramaSkyMaterial - panorama = GradientTexture2D, set your custom gradient, finished.