On darkmode enabled, when searching a keyword inside Request Body or Response Body, the screen shows matched (highlighted) text only. The remaining text appear black, blend with its background color, so it can't be read.
The issue was raised on https://github.com/pmusolino/Wormholy/issues/128
Steps to reproduce
Run in darkmode
Shake to trigger Wormholy interface
Tap one of API listed there
Tap View Body inside Request Body or Response Body section
Tap search button, search any keyword contained in request/response body
What is the current bug behavior?
The screen shows highlighted matched text only. The remaining are black, blends with its background color.
What is the expected correct behavior?
The screen should show remaining non-matched text also.
Root Cause
On WHTextView inside highlight(text:with:font:highlightedFont:) -> [NSTextCheckingResult] method, it adds attributes only to the highlighted text. But for the default text (non-matched) attribute wasn't set yet. That's why its text color was black as same as its background color.
How to solve ?
Set attributes .foregroundColor to UIColor.label as default attribute to the text. Please note that UIColor.label is only available for iOS 13 or above, since dark mode feature was first introduced in that iOS version.
Summary
On darkmode enabled, when searching a keyword inside Request Body or Response Body, the screen shows matched (highlighted) text only. The remaining text appear black, blend with its background color, so it can't be read. The issue was raised on https://github.com/pmusolino/Wormholy/issues/128
Steps to reproduce
View Body
insideRequest Body
orResponse Body
sectionWhat is the current bug behavior?
The screen shows highlighted matched text only. The remaining are black, blends with its background color.
What is the expected correct behavior?
The screen should show remaining non-matched text also.
Root Cause
On
WHTextView
insidehighlight(text:with:font:highlightedFont:) -> [NSTextCheckingResult]
method, it adds attributes only to the highlighted text. But for the default text (non-matched) attribute wasn't set yet. That's why its text color was black as same as its background color.How to solve ?
Set attributes
.foregroundColor
toUIColor.label
as default attribute to the text. Please note thatUIColor.label
is only available for iOS 13 or above, since dark mode feature was first introduced in that iOS version.Relevant logs and/or screenshots