gui icon indicating copy to clipboard operation
gui copied to clipboard

Change address / amount error background

Open w0xlt opened this issue 3 years ago • 11 comments

This PR proposes a small change in QLineEdit when there is an error in the input.

master
image
PR
image

This also shows good results when combined with other open PRs.

#537
image
#533
image

w0xlt avatar Feb 18 '22 21:02 w0xlt

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #537 (Point out position of invalid characters in Bech32 addresses by luke-jr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

DrahtBot avatar Feb 18 '22 23:02 DrahtBot

This also shows good results when combined with other open PRs.

#537

Well, now the background would be theme-dependent, and #537 will need to figure out a reasonable contrasting colour...

luke-jr avatar Feb 19 '22 01:02 luke-jr

IMO this improves text contrast.

However, other improvements could be made as well, some suggestions:

  • consistent error message near the invalid fields, for instance, the error message for invalid change address is displayed on the right while the upcoming bech32 error shows on the top
  • the amount field only turns red when clicking send and it's zero
  • the send button remains enabled while a field is invalid, maybe it should be disabled

promag avatar Feb 22 '22 00:02 promag

consistent error message near the invalid fields, for instance, the error message for invalid change address is displayed on the right while the upcoming bech32 error shows on the top

@promag I addressed this suggestion in https://github.com/bitcoin-core/gui/pull/560

w0xlt avatar Feb 26 '22 05:02 w0xlt

@jarolrod - thanks for pinging me on this - my apologizes for not seeing it sooner...

@w0xlt,

Just to define the issue with more clarity,

We can see using this color contrast calculator that in the light theme (on Mac) that the black text on the rgb(255,128,128) is "ok" kinda... :)

Screen Shot 2022-03-16 at 5 59 59 AM

But when we switch to the dark theme (on Mac) the contrast becomes unsatisfactory from a contrast perspective and is apparent just by looking at it.

Screen Shot 2022-03-16 at 6 00 29 AM

RandyMcMillan avatar Mar 16 '22 10:03 RandyMcMillan

When fe7c81e34e2e16c4a5ec967645ebb49e161d3a25 is tested against light/dark theme changes (on Mac) we get...

Screen Shot 2022-03-16 at 6 41 19 AM

Screen Shot 2022-03-16 at 6 42 05 AM

which doesn't work because the text color is changed based on system theme...

RandyMcMillan avatar Mar 16 '22 10:03 RandyMcMillan

Screen Shot 2022-03-16 at 7 26 55 AM

Screen Shot 2022-03-16 at 7 27 09 AM

Screen Shot 2022-03-16 at 7 27 35 AM

RandyMcMillan avatar Mar 16 '22 11:03 RandyMcMillan

Here are a couple patches to experiment with palleteRole in Qt: You will have to call the text field to update during the system theme change - other wise it will only update when it receives focus.

diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h
index 60e8ee2420..8b37c5dfb4 100644
--- a/src/qt/guiconstants.h
+++ b/src/qt/guiconstants.h
@@ -25,7 +25,7 @@ static const int STATUSBAR_ICONSIZE = 16;
 static const bool DEFAULT_SPLASHSCREEN = true;
 
 /* Invalid field background style */
-#define STYLE_INVALID "border: 3px solid #FF8080"
+#define STYLE_INVALID "color: palette(highlighted-text); background-color: pallet(shadow); border: 3px solid #FF8080"
 
 /* Transaction list -- unconfirmed transaction */
 #define COLOR_UNCONFIRMED QColor(128, 128, 128)

diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h
index 60e8ee2420..dca896ca7e 100644
--- a/src/qt/guiconstants.h
+++ b/src/qt/guiconstants.h
@@ -25,7 +25,7 @@ static const int STATUSBAR_ICONSIZE = 16;
 static const bool DEFAULT_SPLASHSCREEN = true;
 
 /* Invalid field background style */
-#define STYLE_INVALID "border: 3px solid #FF8080"
+#define STYLE_INVALID "color: palette(highlighted-text); background-color: pallet(window); border: 3px solid #FF8080"
 
 /* Transaction list -- unconfirmed transaction */
 #define COLOR_UNCONFIRMED QColor(128, 128, 128)

RandyMcMillan avatar Mar 16 '22 11:03 RandyMcMillan

@RandyMcMillan Thanks for the detailed review and suggestions. I will apply and test them.

w0xlt avatar Apr 12 '22 04:04 w0xlt

@RandyMcMillan I tried your suggestions (palette(window), palette(shadow)) and also palette(base), but none of them worked. However I didn't test on MacOS, I did it on Ubuntu by setting the theme using Qt5 Settings.

w0xlt avatar Jul 14 '22 12:07 w0xlt

I actually prefer the red highlighting. IMO it's more contrasting and more of an alert

Rspigler avatar Aug 01 '22 21:08 Rspigler