Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/devtools_app_shared/lib/src/ui/theme/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,9 @@ const darkColorScheme = ColorScheme(
);

const searchMatchColor = Colors.yellow;
final searchMatchColorOpaque = Colors.yellow.withValues(alpha: 255 / 2);
final searchMatchColorOpaque = Colors.yellow.withValues(alpha: 0.5);
const activeSearchMatchColor = Colors.orangeAccent;
final activeSearchMatchColorOpaque =
Colors.orangeAccent.withValues(alpha: 255 / 2);
final activeSearchMatchColorOpaque = Colors.orangeAccent.withValues(alpha: 0.5);
Comment on lines +227 to +229

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

[CONCERN] The variable names searchMatchColorOpaque and activeSearchMatchColorOpaque are misleading because they actually represent translucent colors (with an alpha of 0.5), whereas searchMatchColor and activeSearchMatchColor are the fully opaque versions. Consider renaming these variables to searchMatchColorTranslucent and activeSearchMatchColorTranslucent (or similar) to accurately reflect their properties and avoid confusion for future maintainers. Note that this would require updating their usages in _table_row.dart and other files.

References
  1. The repository style guide emphasizes 'Meaningful Naming' under Code Quality constraints. (link)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair comment!


/// Gets an alternating color to use for indexed UI elements.
Color alternatingColorForIndex(int index, ColorScheme colorScheme) {
Expand Down
11 changes: 11 additions & 0 deletions packages/devtools_app_shared/test/ui/theme_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,15 @@ void main() {
);
});
});

group('search match colors', () {
// Regression test for https://github.com/flutter/devtools/issues/9010: the
// "opaque" search match colors are blended over the row background, so they
// must stay translucent. Otherwise the (theme-colored) row text is drawn on
// a fully opaque highlight and becomes unreadable.
test('are translucent so row text stays legible', () {
expect(searchMatchColorOpaque.a, closeTo(0.5, 0.001));
expect(activeSearchMatchColorOpaque.a, closeTo(0.5, 0.001));
});
});
}
Loading