We present a novel and flexible method to generate two-color x-ray free-electron-laser (FEL) pulses with variable color separation and time delay using a double-slotted foil on a beam with a large energy chirp. The color separation and time delay between pulses can be set independently by tuning the separation between the slots and the longitudinal dispersion of a magnetic chicane. This method presents some advantages in comparison to previous proposals; it is compact, no large hardware component is needed, and no modifications of the machine settings in the FEL injector are required. Start-to-end numerical simulations for the SwissFEL case show the validity and tunability of our method and its application range: $\ensuremath{-}60$ to $+80\text{ }\text{ }\mathrm{fs}$ time delay and 0 to 3% color separation between the two pulses for a central wavelength of 0.1 nm.