-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Adopt style colour for button icons #5493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c2c2e76
to
c627c02
Compare
I also don't like what @jonasschnelli posted... |
I love playing around with this, make the color selectable, go crazy, but please default to neutral black. Or at least the font color for dark themes, if black has too little contrast with the background? However, it looks like your current code ignores the theme by using static QColor(palette), and uses the silly Qt default instead. This must pass through QApplication: ie
Nit: |
const int gray = 100 + qGray(rgb); | ||
QColor colour = colourbase.lighter(gray); | ||
colour.setAlpha(qAlpha(rgb)); | ||
img.setPixel(x, y, colour.rgba()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this construction with lighter(). Just substitute the color, keep the alpha:
const QRgb rgb = img.pixel(x, y);
img.setPixel(x, y, qRgba(base.red(), base.green(), base.blue(), qAlpha(rgb)));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I drop .lighter, won't everything become the same colour shade (ignoring alpha)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't analyzed @jonasschnelli 's icons, but my observation was that everything already is in the same shade of black, the deepest shade of black available, and it is just alpha that varies.
extern QIcon SingleColourIcon(const QIcon&); | ||
extern QIcon SingleColourIcon(const QString& filename); | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Missing header end comment.
cb3361b
to
d6b5cd6
Compare
Text colour (black, in my case) is exactly the boring/ugly I'm trying to avoid here... How's this new version look on your platforms? The logic now is: |
for (int x = img.width(); x--; ) | ||
{ | ||
for (int y = img.height(); y--; ) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you at least take my comment into account? Does this code make any difference with what I gave?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a basic run:
2 gray:120
2 gray:127
2 gray:128
2 gray:129
4 gray:118
4 gray:122
4 gray:124
6 gray:121
6 gray:123
8 gray:117
10 gray:115
10 gray:119
12 gray:114
12 gray:125
16 gray:116
42 gray:113
54 gray:111
76 gray:112
106 gray:107
110 gray:109
124 gray:105
174 gray:108
176 gray:110
216 gray:104
232 gray:106
434 gray:103
454 gray:101
572 gray:102
263287 gray:100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(that's approximately 1% of sampled pixels that are lighter than solid block)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure the base level is 0 i.e. absolute black, not 100.
Are you maybe counting the color of pixels with zero alpha (which you can't see anyway)? Or feeding the odd non-onecolor old icon through it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case this is not a lot of variability. I leave it up to @jonasschnelli to confirm this, but I'd say it looks accidental and they're supposed to be 100% one-color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was printing the gray variable, which is qGray + 100
I was not counting the zero-alpha pixels, though I have no idea what icons were being fed through it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's just /icons/about
d6b5cd6
to
880e7aa
Compare
const QRgb rgb = img.pixel(x, y); | ||
QColor color = colorbase; | ||
color.setAlpha(qAlpha(rgb)); | ||
img.setPixel(x, y, color.rgba()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be reduced to two lines, you don't have to go through QColor at all:
const QRgb rgb = img.pixel(x, y);
img.setPixel(x, y, qRgba(base.red(), base.green(), base.blue(), qAlpha(rgb)));
Now it looks like this on OSX (see below). On @laanwj screen it looks really nice with the white icons! |
@@ -14,6 +14,7 @@ | |||
|
|||
#include "coincontrol.h" | |||
#include "main.h" | |||
#include "scicon.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This include belongs into the Qt include block. This here is for core includes :).
880e7aa
to
7853535
Compare
Changes made. Per @jonasschnelli's review, I think the Mac-specific change @laanwj requested is unnecessary? |
It looks like that is already automatic, which is better than making a special exception. |
Now it look like this on my environments (see below).
OSX 10.10OSX 10.9Ubuntu |
Is the grey-on-grey menu icons with a case of style change going on? Or is Qt misreporting text colour somehow in that case? |
I just tried. Could not manage to get some other icon color than the black one on my OSX 10.10.
You could re-test and compare the text-color when the main window becomes focus?
Is there no way to detect the menu background color and do a HLS change on 180° so we can get the "opposite color"? Or maybe this looks bad. Maybe only detect the black-value/threshold and decide to color the icons black or white? |
The standard Ubuntu style is nice. I like how it picks up the orange.
|
9b7d3fb Adopt style colour for button icons (Luke Dashjr)
Merged via e515309, further fixes can be applied later, but merging this before it runs too much out of sync |
Yes, definitely shouldn't be light blue on windows. Thanks for testing. |
It's light-blue to match the highlight colour - looks fine to me? |
@luke-jr too low contrast with the grey |
light-blue is not a good choice for windows. @Diapolo could you post some windows screens when manipulating your Theme or color-schema? |
The blue is essentially what I get here in KDE. I think it looks good both with the blue and your high contrast screenshot. Please suggest an alternative, if you don't like it... |
No description provided.