Use GitHub's diff colours for changed lines and +/- counts

Added and removed lines take GitHub's green and red tints, with the code in
the label colour and the +/- marker and counts in GitHub's strong green and
red, in both themes and hosts.
This commit is contained in:
2026-10-31 19:54:48 +00:00
parent 53be2e5334
commit 23ff72934e
3 changed files with 67 additions and 32 deletions
@@ -114,7 +114,6 @@ class _LineRow extends StatelessWidget {
? ' ' * (width * 2 + 1)
: '${gutterText(line.oldLine, width)} ${gutterText(line.newLine, width)}';
final colors = diffLineColors(context, line.kind);
final content = '${diffLineSymbol(line.kind)} ${line.text}';
return Container(
color: colors.background,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 2),
@@ -126,7 +125,16 @@ class _LineRow extends StatelessWidget {
style: base.copyWith(color: mutedColor(context)),
),
TextSpan(
text: content,
text: diffLineSymbol(line.kind),
style: base.copyWith(
color: colors.marker,
fontWeight: line.kind == ChangeLineKind.context
? null
: FontWeight.w700,
),
),
TextSpan(
text: ' ${line.text}',
style: base.copyWith(color: colors.text),
),
],