You do not have completely free choice of which two color tones to use, but this is actually possible with a non-group shape.
The puzzle for you is how, hint: it is actually quite simple, I just did not expect this setting to have this effect on a line, but now it is quite obvious.
Challenge:
- The line must be around a rectangle.
- The thickness of the 'lines' must be exactly the same for the two color tones.
- If you are able to achieve this with line gradients I am very impressed (could be doable not sure, then you can choose from all colors), but it is much more simple than this.