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
4 changes: 2 additions & 2 deletions packages/devtools_app/lib/src/shared/table/_table_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ class _TableRowState<T> extends State<TableRow<T>>
final searchAwareBackgroundColor = isSearchMatch
? Color.alphaBlend(
isActiveSearchMatch
? activeSearchMatchColorOpaque
: searchMatchColorOpaque,
? activeSearchMatchColorTranslucent
: searchMatchColorTranslucent,
backgroundColor,
)
: backgroundColor;
Expand Down
4 changes: 3 additions & 1 deletion packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ To learn more about DevTools, check out the

## General updates

TODO: Remove this section if there are not any updates.
* Fixed a bug where highlighted search matches in tables were unreadable in dark
mode because the highlight color had become fully opaque. -
[#9863](https://github.com/flutter/devtools/pull/9863)

## Inspector updates

Expand Down
7 changes: 4 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,11 @@ const darkColorScheme = ColorScheme(
);

const searchMatchColor = Colors.yellow;
final searchMatchColorOpaque = Colors.yellow.withValues(alpha: 255 / 2);
final searchMatchColorTranslucent = Colors.yellow.withValues(alpha: 0.5);
const activeSearchMatchColor = Colors.orangeAccent;
final activeSearchMatchColorOpaque =
Colors.orangeAccent.withValues(alpha: 255 / 2);
final activeSearchMatchColorTranslucent = Colors.orangeAccent.withValues(
alpha: 0.5,
);

/// 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(searchMatchColorTranslucent.a, closeTo(0.5, 0.001));
expect(activeSearchMatchColorTranslucent.a, closeTo(0.5, 0.001));
});
});
}
Loading