transformStyle method

UvStyle transformStyle(
  1. UvStyle style, {
  2. bool foreground = true,
  3. bool background = true,
  4. bool underlineColor = true,
})

Applies this matrix to style.

Implementation

UvStyle transformStyle(
  UvStyle style, {
  bool foreground = true,
  bool background = true,
  bool underlineColor = true,
}) {
  if (style.isZero || isIdentity) return style;
  final fg = foreground ? transformColor(style.fg) : style.fg;
  final bg = background ? transformColor(style.bg) : style.bg;
  final uc = underlineColor
      ? transformColor(style.underlineColor)
      : style.underlineColor;
  if (fg == style.fg && bg == style.bg && uc == style.underlineColor) {
    return style;
  }
  return UvStyle(
    fg: fg,
    bg: bg,
    underlineColor: uc,
    underline: style.underline,
    attrs: style.attrs,
  );
}