Unfortunately, yEd does not offer an "adopt color from expanded group" setting for collapsed groups, nor does it offer "adopt color from collapsed group" for expanded groups.
However, if you already know that you will never change the color of your collapsed and expanded groups after the initial color change, you could use custom default styles for your collapsed and expanded groups that already have the desired color.
To do that,