copyWith method

UvStyle copyWith({
  1. UvColor? fg,
  2. bool clearFg = false,
  3. UvColor? bg,
  4. bool clearBg = false,
  5. UvColor? underlineColor,
  6. bool clearUnderlineColor = false,
  7. UnderlineStyle? underline,
  8. int? attrs,
})

Returns a copy of this style with selected fields updated.

Implementation

UvStyle copyWith({
  UvColor? fg,
  bool clearFg = false,
  UvColor? bg,
  bool clearBg = false,
  UvColor? underlineColor,
  bool clearUnderlineColor = false,
  UnderlineStyle? underline,
  int? attrs,
}) {
  return UvStyle(
    fg: clearFg ? null : (fg ?? this.fg),
    bg: clearBg ? null : (bg ?? this.bg),
    underlineColor: clearUnderlineColor
        ? null
        : (underlineColor ?? this.underlineColor),
    underline: underline ?? this.underline,
    attrs: attrs ?? this.attrs,
  );
}