WebPositive: uses system colors for url text

* Fixes #14518

Change-Id: I76f33694d318e93c096ecab24a9b0316eacda68e
Reviewed-on: https://review.haiku-os.org/613
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: Skipp_OSX <jscipione@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Janus 2018-10-04 10:15:45 +02:00 committed by waddlesplash
parent 6d18e980e1
commit 49a3ee2a3b

View File

@ -382,17 +382,20 @@ URLInputGroup::URLTextView::InsertText(const char* inText, int32 inLength,
BFont font; BFont font;
GetFont(&font); GetFont(&font);
const rgb_color black = (rgb_color) { 0, 0, 0, 255 }; const rgb_color hostColor = ui_color(B_DOCUMENT_TEXT_COLOR);
const rgb_color gray = (rgb_color) { 60, 60, 60, 255 }; const rgb_color urlColor = tint_color(hostColor,
(hostColor.Brightness() < 128 ? B_LIGHTEN_1_TINT : B_DARKEN_1_TINT));
if (baseUrlStart > 0) if (baseUrlStart > 0)
SetFontAndColor(0, baseUrlStart, &font, B_FONT_ALL, &gray); SetFontAndColor(0, baseUrlStart, &font, B_FONT_ALL, &urlColor);
if (baseUrlEnd > baseUrlStart) { if (baseUrlEnd > baseUrlStart) {
font.SetFace(B_BOLD_FACE); font.SetFace(B_BOLD_FACE);
SetFontAndColor(baseUrlStart, baseUrlEnd, &font, B_FONT_ALL, &black); SetFontAndColor(baseUrlStart, baseUrlEnd, &font, B_FONT_ALL,
&hostColor);
} }
if (baseUrlEnd < TextLength()) { if (baseUrlEnd < TextLength()) {
font.SetFace(B_REGULAR_FACE); font.SetFace(B_REGULAR_FACE);
SetFontAndColor(baseUrlEnd, TextLength(), &font, B_FONT_ALL, &gray); SetFontAndColor(baseUrlEnd, TextLength(), &font, B_FONT_ALL,
&urlColor);
} }
fURLAutoCompleter->TextModified(fUpdateAutoCompleterChoices); fURLAutoCompleter->TextModified(fUpdateAutoCompleterChoices);