# copy

> Returns a copy of this [LegacySpanStyle] with optionally overridden fields, preserving the existing [textForegroundStyle] (including a [Brush]) when [color] equals `this.color`.

## API Reference

### copy

> Source set: Common

```kotlin
fun copy(
        color: Color = this.color,
        fontSize: TextUnit = this.fontSize,
        fontWeight: FontWeight? = this.fontWeight,
        fontStyle: FontStyle? = this.fontStyle,
        fontSynthesis: FontSynthesis? = this.fontSynthesis,
        fontFamily: FontFamily? = this.fontFamily,
        fontFeatureSettings: String? = this.fontFeatureSettings,
        letterSpacing: TextUnit = this.letterSpacing,
        baselineShift: BaselineShift? = this.baselineShift,
        textGeometricTransform: TextGeometricTransform? = this.textGeometricTransform,
        localeList: LocaleList? = this.localeList,
        background: Color = this.background,
        textDecoration: TextDecoration? = this.textDecoration,
        shadow: Shadow? = this.shadow,
        platformStyle: PlatformSpanStyle? = this.platformStyle,
        drawStyle: DrawStyle? = this.drawStyle,
    ): LegacySpanStyle
```

Returns a copy of this `LegacySpanStyle` with optionally overridden fields, preserving the
existing `textForegroundStyle` (including a `Brush`) when [color](https://composables.com/jetpack-compose/androidx.compose.ui/ui-text/properties/color/api.md) equals `this.color`.

### copy

> Source set: Common

```kotlin
fun copy(
        brush: Brush?,
        alpha: Float = this.alpha,
        fontSize: TextUnit = this.fontSize,
        fontWeight: FontWeight? = this.fontWeight,
        fontStyle: FontStyle? = this.fontStyle,
        fontSynthesis: FontSynthesis? = this.fontSynthesis,
        fontFamily: FontFamily? = this.fontFamily,
        fontFeatureSettings: String? = this.fontFeatureSettings,
        letterSpacing: TextUnit = this.letterSpacing,
        baselineShift: BaselineShift? = this.baselineShift,
        textGeometricTransform: TextGeometricTransform? = this.textGeometricTransform,
        localeList: LocaleList? = this.localeList,
        background: Color = this.background,
        textDecoration: TextDecoration? = this.textDecoration,
        shadow: Shadow? = this.shadow,
        platformStyle: PlatformSpanStyle? = this.platformStyle,
        drawStyle: DrawStyle? = this.drawStyle,
    ): LegacySpanStyle
```

Returns a copy of this `LegacySpanStyle` with the foreground replaced by [brush](https://composables.com/jetpack-compose/androidx.compose.ui/ui-text/properties/brush/api.md) and [alpha](https://composables.com/jetpack-compose/androidx.compose.ui/ui-text/properties/alpha/api.md).
