Brush brush = new SolidColorBrush(color);
The other way around:
if (brush is SolidColorBrush colorBrush)
Color color = colorBrush.Color;
Or something like that.
Point being not all brushes are colors but you could turn all colors into a (SolidColor)Brush.