Making two different bones copy different axis on a target bone's rotation
I believe what you need is to copy rotation.
Under bone constraints, select copy rotation, and select the bone you want to take the rotation values from. You can also choose which axis to copy.

In your case, as you want the red bone to follow the hand bone's y axis, you would add a copy rotation on the red bone, and make the target the hand bone (green). Then you would uncheck the x and z boxes, so the red bone only looks at the hand bone's y rotation.
You would do the same with the blue bone. Add contraint, set target as hand bone, then make sure only z is selected.
If you are unsure of how to target the hand bone:

Under Target, select Armature
A new box will appear underneath, labelled Bone
In the Bone box, select the hand bone.

You can also use the eyedropper icon. Select it, on the right of the box, and click on your Armiture, in the 3D (main editor) view.