withOverrides method

TerminalColorTheme withOverrides(
  1. CustomPaletteOverrides overrides
)

Returns a derived theme with overrides applied.

Implementation

TerminalColorTheme withOverrides(CustomPaletteOverrides overrides) {
  if (overrides.isEmpty) return this;
  final nextAnsi = List<Color>.unmodifiable([
    for (var i = 0; i < 16; i++) overrides.ansiOverrides[i] ?? ansi[i],
  ]);
  return TerminalColorTheme(
    id: id,
    name: name,
    brightness: brightness,
    foreground: overrides.foreground ?? foreground,
    background: overrides.background ?? background,
    cursorColor: overrides.cursorColor ?? cursorColor,
    cursorTextColor: overrides.cursorTextColor ?? cursorTextColor,
    selectionBackground: overrides.selectionBackground ?? selectionBackground,
    selectionForeground: overrides.selectionForeground ?? selectionForeground,
    ansi: nextAnsi,
  );
}