machinectl shell gdm@ $(type -P gsettings) set org.gnome.desktop.interface accent-color "pink"

This command will change the accent color to pink, but replace pink with any supported color.

I’m not very familiar with the machinectl command, but what I think it’s doing is running the gsettings command as the gdm user.