I would have two methods - activateFilterWithReplace (for color) and activateFilterWithAppend (for size).
I would also use the URLSearchParams rather than a plain javascript object to create the query string. It lets you have the same key with different values like you want for size.
You can see the API for it here: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
You will want to look at URLSearchParams.set() for the color filter, URLSearchParams.append() for the size filter and URLSearchParams.toString() to create the query string.