merge method

Style merge(
  1. Style other
)

Merges another style onto this one.

Attributes in other take precedence if they are not null or default.

Implementation

Style merge(Style other) {
  var nextModifiers = modifiers | other.modifiers;
  // Clear transparent bit if merging with a style that is not transparent.
  if (!Modifier.has(other.modifiers, Modifier.transparent)) {
    nextModifiers &= ~Modifier.transparent;
  }
  return Style(
    foreground: other.foreground ?? foreground,
    background: other.background ?? background,
    modifiers: nextModifiers,
  );
}