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:
@@ -88,15 +88,29 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
materialHost(const SizedBox.shrink(), brightness: brightness),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final context = tester.element(find.byType(Scaffold));
|
||||
final add = diffLineColors(context, ChangeLineKind.add);
|
||||
final remove = diffLineColors(context, ChangeLineKind.remove);
|
||||
// Additions are green and removals red, each line on a light tint.
|
||||
expect(add.background, isNotNull);
|
||||
expect(remove.background, isNotNull);
|
||||
expect(add.text, isNot(remove.text), reason: '$brightness text');
|
||||
expect(add.text.g, greaterThan(add.text.r), reason: 'green addition');
|
||||
expect(remove.text, Theme.of(context).colorScheme.error);
|
||||
// GitHub's palette: green and red line tints and markers.
|
||||
final dark = brightness == Brightness.dark;
|
||||
expect(
|
||||
add.background,
|
||||
dark ? const Color(0x262EA043) : const Color(0xFFDAFBE1),
|
||||
);
|
||||
expect(
|
||||
remove.background,
|
||||
dark ? const Color(0x1AF85149) : const Color(0xFFFFEBE9),
|
||||
);
|
||||
expect(
|
||||
add.marker,
|
||||
dark ? const Color(0xFF3FB950) : const Color(0xFF1A7F37),
|
||||
);
|
||||
expect(
|
||||
remove.marker,
|
||||
dark ? const Color(0xFFF85149) : const Color(0xFFD1242F),
|
||||
);
|
||||
expect(add.text, Theme.of(context).colorScheme.onSurface);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user