---
title: "mix(with:by:in:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/color/mix(with:by:in:)"
---

# mix(with:by:in:)

Returns a version of self mixed with rhs by the amount specified by fraction.

## Declaration

```swift
func mix(with rhs: Color, by fraction: Double, in colorSpace: Gradient.ColorSpace = .perceptual) -> Color
```

## Parameters

- `rhs`: The color to mix self with.
- `fraction`: The amount of blending, 0.5 means self is mixed in equal parts with rhs.
- `colorSpace`: The color space used to mix the colors.

## Return Value

Return Value A new Color based on self and rhs.

## See Also

### Modifying a color

- [opacity(_:)](swiftui/color/opacity(_:).md)
- [gradient](swiftui/color/gradient.md)
- [exposureAdjust(_:)](swiftui/color/exposureadjust(_:).md)
- [headroom(_:)](swiftui/color/headroom(_:).md)
