resolveNativeStyleColors static method

({Color background, Color foreground}) resolveNativeStyleColors({
  1. required GhosttyTerminalResolvedStyle style,
  2. required Color defaultForeground,
  3. required Color defaultBackground,
  4. Color? metadataColor,
})

Resolves this style's colors for paint-time use.

When metadataColor is provided and this style has no explicit background, the metadata color becomes the effective background.

Implementation

static ({Color foreground, Color background}) resolveNativeStyleColors({
  required GhosttyTerminalResolvedStyle style,
  required Color defaultForeground,
  required Color defaultBackground,
  Color? metadataColor,
}) {
  final resolvedBackground =
      metadataColor == null || style.hasExplicitBackground
      ? style.background
      : metadataColor;
  return (foreground: style.foreground, background: resolvedBackground);
}