DiffStyles.light constructor
DiffStyles.light()
Creates a light-theme diff style preset.
Uses a warm cream background with pastel green/pink highlights for
added/removed lines. Code text is dark; only +/- markers use
colored foregrounds. Suitable for terminals with a light background
or when explicitly filling the screen with a light color scheme.
Implementation
factory DiffStyles.light() {
// ── Palette ──────────────────────────────────────────────────────────────
const cream = BasicColor('#faf6f1'); // overall warm cream background
const darkText = BasicColor('#24292f'); // near-black code text
const mutedText = BasicColor('#6e7781'); // muted gray for line numbers
const fileHeaderText = BasicColor('#57606a'); // slightly darker muted
const greenMarker = BasicColor('#1a7f37'); // deep green for + markers
const redMarker = BasicColor('#cf222e'); // deep red for - markers
const hunkText = BasicColor('#8b949e'); // subtle gray for hunk headers
const addedBg = BasicColor('#dafbe1'); // pastel green background
const removedBg = BasicColor('#ffebe9'); // pastel pink background
const inlineAddedBg = BasicColor('#abf2bc'); // stronger green highlight
const inlineRemovedBg = BasicColor('#ffc1ba'); // stronger pink highlight
const emptyCellBg = BasicColor('#f0ebe6'); // slightly darker cream
return DiffStyles(
// ── Unified mode ────────────────────────────────────────────────────
addedLine: Style().foreground(darkText).background(addedBg),
removedLine: Style().foreground(darkText).background(removedBg),
contextLine: Style().foreground(darkText).background(cream),
fileHeader: Style().bold().foreground(fileHeaderText).background(cream),
hunkHeader: Style().foreground(hunkText).background(cream),
addedGutter: Style().foreground(greenMarker).background(addedBg).bold(),
removedGutter: Style().foreground(redMarker).background(removedBg).bold(),
contextGutter: Style().foreground(mutedText).background(cream),
lineNumber: Style().foreground(mutedText).background(cream),
// ── Pretty mode ─────────────────────────────────────────────────────
prettyAddedLine: Style().foreground(darkText).background(addedBg),
prettyRemovedLine: Style().foreground(darkText).background(removedBg),
prettyContextLine: Style().foreground(darkText).background(cream),
prettyFileHeader: Style().foreground(fileHeaderText).background(cream),
prettyAddedLineNumber: Style()
.foreground(greenMarker)
.background(addedBg),
prettyRemovedLineNumber: Style()
.foreground(redMarker)
.background(removedBg),
prettyContextLineNumber: Style().foreground(mutedText).background(cream),
// ── Side-by-side mode ───────────────────────────────────────────────
sideBySideSeparator: Style().foreground(mutedText).background(cream),
sideBySideAddedLine: Style().foreground(darkText).background(addedBg),
sideBySideRemovedLine: Style().foreground(darkText).background(removedBg),
sideBySideContextLine: Style().foreground(darkText).background(cream),
sideBySideLineNumber: Style().foreground(mutedText).background(cream),
sideBySideEmptyCell: Style()
.foreground(mutedText)
.background(emptyCellBg),
sideBySideAddedMarker: Style()
.foreground(greenMarker)
.background(addedBg),
sideBySideRemovedMarker: Style()
.foreground(redMarker)
.background(removedBg),
sideBySideContextMarker: Style().foreground(mutedText).background(cream),
// ── Inline diff highlighting ────────────────────────────────────────
inlineAddedHighlight: Style()
.foreground(darkText)
.background(inlineAddedBg),
inlineRemovedHighlight: Style()
.foreground(darkText)
.background(inlineRemovedBg),
);
}