Apply your gradient to a shape (using the 2 colors)

Now go to Object → Expand and set it to the amount of colors you want (I did 15)

Right click → Ungroup and Right Click → Release clipping mask
Now click the new folder Icon in swatches panel (Window → Swatches) and make sure to select "from artwork" and it will make a folder of swatches using the colors from your gradient. (you will have chosen earlier exactly how many)

Apply your gradient to a shape (using the 2 colors)

Now go to Object → Expand and set it to the amount of colors you want (I did 15)

Right click → Ungroup and Right Click → Release clipping mask
Now click the new folder Icon in swatches panel (Window → Swatches) and make sure to select "from artwork" and it will make a folder of swatches using the colors from your gradient. (you will have chosen earlier exactly how many)

You can add colors to a gradient simply by dragging the color swatch onto the gradient palette, on the gradient line.
If you want to remove a color from a gradient, drag it down from the gradient line.
Once your gradient is done, you can drag it from the gradient palette back into the color swatch palette to create a new swatch with the gradient.
Hi there,
Currently working on a large .ai file for a camo pattern. There are multiple layers of different shapes and colours. Two of these layers have gradients across the shapes.
The gradient colours are the same across all shapes, however the direction is different between each. There is something like a hundred shapes in each layer…can I select all and change the colours without affecting the directions of the gradients somehow?
Gradient Mesh in Illustrator
- draw a rectangle
- select the Mesh Tool
- click one corner of the rectangle
- apply corner color
- Select the Direct Selection Tool
- Click another corner anchor and apply color
- repeat for remaining corners

There's no simple, one-click solution for a gradient of that nature.
Shape Layers in Photoshop
For Photoshop, the processes is much more cumbersome and involved and nowhere near as precise.
One method could be to use a separate shape/vector layer for each corner, then a solid filled shape as a base.

You basically set a gradient for each shape:

Then once you have the 4 shapes with Gradients change their blending modes to Darken. You don't absolutely need that bottom white rectangle I used. But things won't look quite right without a solid color (preferably white) background behind the gradient shape layers.
Another method for Photoshop could be to simply grab the Gradient Tool, set a color to transparent gradient and then drag from a corner. Repeat for each of the 4 colors. The problem with this method is that each time you drag, the length of the gradient will be different. So, you won't end up with 4 equal corner gradients. The Vector Layer/Shape Layer method ensures the gradients are all the same length.
In the end, I'd simply generate this in Illustrator and then copy/paste to Photoshop as a Smart Object.
To get the effect you're looking for in Photoshop, I'd suggest the Sblended add-on. Full disclosure: I wrote it.
Here's a screenshot of the interface used to create the gradient.

- add two lines by tapping anywhere in the main area
- add two color stops to each line by tapping anywhere on the line
- position the color stops at the corners by dragging
- pick the colors you'd like by double-tapping a color stop
Once you've built the effect, you can apply it in the same way as the built-in Gradient Tool - by dragging it across whatever area you want.
You can grab the free demo version to try it out here: https://creative.adobe.com/addons/products/17501