Question: What is the best way to merge array contents from JavaScript objects sharing a key in common?

How can array in the example below be reorganized into output? Here, all value keys (whether an array or not) are merged into all objects sharing the same name key.

```js
const array = 
[
  {
    brand: ['Adidas', 'Nike']
    color: ['red']
  },
  {
    brand: ['Puma', 'Nike'],
    size: ['31', '32']
  }
]

/* Expect output
[{
  brand: ['Adidas', 'Puma', 'Nike'],
  size: ['31', '32']
  color: ['red']
}] 
*/

```

Answer: 
1. You basically have to define a brush resource. This example will define this resource in the *App.xaml*.  

Name it e.g. "MainWindowBackgroudBrush":

```xml
<ResourceDictionary>
  <SolidColorBrush x:Key="MainWindowBackgroudBrush"
                   Color="Orange" />
</ResourceDictionary>

```

2. Reference this resource from your `MainWindow` (or in general the `Control` that should have the dynamic background) using `DynamicResource`. `DynamicResource` indicates that the referenced resource is expected to change during runtime (i.e. the resource is dynamic):

```xml
<Window Background="{DynamicResource MainWindowBackgroudBrush}">
</Window>

```

3. Then modify the brush resource from anywhere e.g., from your `SettingsWindow` using the static `Application.Current` property:

```cs
Application.Current.Resources["MainWindowBackgroudBrush"] = Brushes.Red;

```
In visual studio go to your Properties window.
Navigate to settings, add a parameter of type color and give it a name like yourColor
now if you change your color store it in the settings file:

```
properties.settings.default.yourColor = newBackgroundColor;
properties.settings.default.save();

```

wenn you start you window look in your properties and use it as background.

```
this.background = properties.settings.default.yourColor;

```

(pseudocode wont compile)