More consistent recolouring
@@ -1,4 +1,4 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m256,0c-141.385,0-256,114.615-256,256s114.615,256 256,256 256-114.615 256-256-114.615-256-256-256zm0,448c-106.039,0-192-85.961-192-192s85.961-192 192-192 192,85.961 192,192-85.961,192-192,192z"/>
|
||||
<path d="m256,169.2203c-50.3235,0-91.1187,40.7952-91.1187,91.1187s40.7952,91.1186 91.1187,91.1186 91.1186-40.7952 91.1186-91.1186-40.7952-91.1187-91.1186-91.1187zm0,159.4576c-37.7427,0-68.339-30.5963-68.339-68.339s30.5963-68.339 68.339-68.339 68.339,30.5963 68.339,68.339-30.5963,68.339-68.339,68.339z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 595 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m367.497,402.687c-9.476-1.494-9.692-27.327-9.692-27.327s27.844-27.328 33.912-64.076c16.326,0 26.407-39.069 10.082-52.814 .681-14.47 20.984-113.588-81.799-113.588s-82.479,99.118-81.799,113.588c-16.327,13.745-6.244,52.814 10.081,52.814 6.067,36.748 33.913,64.076 33.913,64.076s-.216,25.833-9.692,27.327c-30.524,4.816-144.503,54.658-144.503,109.313h192 192c0-54.655-113.979-104.497-144.503-109.313zm-195.47,8.718c22.047-13.575 48.813-26.154 70.769-33.712-7.876-11.216-16.647-26.468-22.165-44.531-7.703-6.283-13.972-15.266-17.999-26.301-4.033-11.052-5.561-23.426-4.304-34.842 .902-8.196 3.239-15.833 6.825-22.544-2.175-23.293-3.707-69.017 26.224-102.366 11.607-12.933 26.278-22.23 43.85-27.843-3.137-32.38-19.58-70.385-83.227-70.385-102.782,0-82.479,99.118-81.799,113.588-16.327,13.745-6.244,52.814 10.081,52.814 6.067,36.748 33.913,64.076 33.913,64.076s-.216,25.833-9.692,27.327c-30.524,4.817-144.503,54.659-144.503,109.314h164.798c2.355-1.537 4.753-3.07 7.229-4.595z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m368,0h-224c-26.4,0-48,21.6-48,48v416c0,26.4 21.6,48 48,48h224c26.4,0 48-21.6 48-48v-416c0-26.4-21.6-48-48-48zm-176,24h128v16h-128v-16zm64,456c-17.673,0-32-14.327-32-32s14.327-32 32-32 32,14.327 32,32-14.327,32-32,32zm128-96h-256v-320h256v320z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 347 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m432,96h-256c-44,0-80,36-80,80v256c0,44 36,80 80,80h256c44,0 80-36 80-80v-256c0-44-36-80-80-80zm-224,352c-26.51,0-48-21.49-48-48s21.49-48 48-48 48,21.49 48,48-21.49,48-48,48zm0-192c-26.51,0-48-21.49-48-48s21.49-48 48-48 48,21.49 48,48-21.49,48-48,48zm96,96c-26.51,0-48-21.49-48-48s21.49-48 48-48 48,21.49 48,48-21.49,48-48,48zm96,96c-26.51,0-48-21.49-48-48s21.49-48 48-48 48,21.49 48,48-21.49,48-48,48zm0-192c-26.51,0-48-21.49-48-48s21.49-48 48-48 48,21.49 48,48-21.49,48-48,48zm14.38-192c-7.465-36.402-39.855-64-78.38-64h-256c-44,0-80,36-80,80v256c0,38.523 27.598,70.915 64,78.38v-318.38c0-17.6 14.4-32 32-32h318.38z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m416,480 96-256h-416l-96,256zm-352-288-64,288v-416h144l64,64h208v64z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m256,0c-141.385,0-256,114.615-256,256s114.615,256 256,256 256-114.615 256-256-114.615-256-256-256zm-32,96h64v64h-64v-64zm96,320h-128v-32h32v-128h-32v-32h96v160h32v32z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m0,96h512v32h-512zm0,64h352v32h-352zm0,64h512v32h-512zm0,64h352v32h-352zm0,64h512v32h-512zm0,64h352v32h-352z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m256.2712-.5424c-141.5343,0-256.2712,114.7369-256.2712,256.2712s114.7369,256.2712 256.2712,256.2712 256.2712-114.7358 256.2712-256.2712-114.7358-256.2712-256.2712-256.2712zm145.0014,341.6949c4.5808-21.5983 7.4724-44.5228 8.4132-68.339h68.0432c-1.7811,23.5962-7.2738,46.51-16.38,68.339h-60.0764zm-290.0029-170.8475c-4.5808,21.5983-7.4724,44.5228-8.4132,68.339h-68.0421c1.7811-23.5951 7.2728-46.51 16.3789-68.339h60.0764zm255.0037,0c5.1329,21.8696 8.221,44.7695 9.2258,68.339h-102.1433v-68.339h92.9175zm-92.9175-34.1695v-100.0194c7.7896,2.2669 15.5066,6.0704 23.0794,11.4094 14.1921,10.0053 27.7691,25.4178 39.2629,44.573 7.9455,13.2417 14.8168,27.9848 20.553,44.0381h-82.8952zm-96.5117-44.0381c11.4938-19.1552 25.0697-34.5688 39.2629-44.573 7.5717-5.339 15.2898-9.1425 23.0794-11.4094v100.0205h-82.8952c5.7373-16.0522 12.6085-30.7952 20.553-44.0381zm62.3422,78.2076v68.339h-102.1422c1.0037-23.5695 4.0929-46.4694 9.2247-68.339h92.9175zm-187.992,170.8475c-9.1062-21.829-14.5978-44.7428-16.3789-68.339h68.0421c.9407,23.8161 3.8323,46.7407 8.4132,68.339h-60.0764zm85.8498-68.339h102.1422v68.339h-92.9175c-5.1318-21.8685-8.221-44.7695-9.2247-68.339zm102.1422,102.5085v100.0205c-7.7885-2.2669-15.5065-6.0715-23.0794-11.4094-14.1932-10.0053-27.7702-25.4189-39.2629-44.573-7.9455-13.2428-14.8157-27.9859-20.554-44.0381h82.8962zm96.5117,44.0381c-11.4938,19.1541-25.0708,34.5678-39.2629,44.573-7.5728,5.3379-15.2898,9.1425-23.0794,11.4094v-100.0205h82.8963c-5.7373,16.0522-12.6085,30.7953-20.554,44.0381zm-62.3422-78.2075v-68.339h102.1422c-1.0037,23.5695-4.0929,46.4705-9.2258,68.339h-92.9165zm136.3299-102.5085c-.9407-23.8161-3.8323-46.7407-8.4132-68.339h60.0764c9.1062,21.829 14.5989,44.7439 16.38,68.339h-68.0432zm33.8011-102.5085h-51.2009c-9.9508-31.3729-23.6923-58.8858-40.2111-80.8471 22.7099,10.8595 43.2767,25.4221 61.2456,43.391 11.4681,11.4671 21.5492,23.9923 30.1663,37.4562zm-344.2651-37.4562c17.97-17.9699 38.5368-32.5315 61.2456-43.391-16.5199,21.9614-30.2592,49.4742-40.2111,80.8471h-51.1998c8.616-13.4638 18.6982-25.9891 30.1653-37.4562zm-30.1653,276.6426h51.1998c9.9519,31.3729 23.6923,58.8858 40.2122,80.8482-22.7099-10.8595-43.2767-25.4221-61.2456-43.392-11.4681-11.4671-21.5503-23.9923-30.1663-37.4562zm344.264,37.4562c-17.9689,17.97-38.5368,32.5326-61.2456,43.392 16.5199-21.9614 30.2603-49.4753 40.2111-80.8482h51.2009c-8.6171,13.4639-18.6982,25.9891-30.1663,37.4562z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m192,32h320v64h-320v-64zm0,192h320v64h-320v-64zm0,192h320v64h-320v-64zm-192-352a64,64 0 1,0 128,0 64,64 0 1,0 -128,0zm0,192a64,64 0 1,0 128,0 64,64 0 1,0 -128,0zm0,192a64,64 0 1,0 128,0 64,64 0 1,0 -128,0z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m96,64 320,192-320,192z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="#282828" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="#404040" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m192,256a64,64 0 1,0 128,0 64,64 0 1,0 -128,0zm140.174-140.737c49.926,27.079 83.826,79.949 83.826,140.737s-33.9,113.658-83.826,140.737c22.033-35.063 35.826-85.135 35.826-140.737s-13.793-105.674-35.826-140.737zm-188.174,140.737c0,55.602 13.792,105.674 35.826,140.737-49.926-27.08-83.826-79.949-83.826-140.737s33.9-113.657 83.826-140.737c-22.034,35.063-35.826,85.135-35.826,140.737zm-96,0c0,85.95 27.202,163.092 70.326,215.861-71.151-45.474-118.326-125.157-118.326-215.861s47.175-170.387 118.326-215.861c-43.124,52.769-70.326,129.911-70.326,215.861zm345.676-215.86c71.149,45.473 118.324,125.156 118.324,215.86s-47.175,170.387-118.324,215.86c43.122-52.768 70.324-129.91 70.324-215.86s-27.202-163.092-70.324-215.86z"></path>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 815 B |
@@ -45,27 +45,22 @@ static bool inline isLight(const QColor &col)
|
||||
return col.red()>100 && col.blue()>100 && col.green()>100;
|
||||
}
|
||||
|
||||
static bool inline isDark(const QColor &col)
|
||||
static bool inline isVeryLight(const QColor &col, int limit=240)
|
||||
{
|
||||
return col.red()<80 && col.blue()<80 && col.green()<80;
|
||||
return col.red()>=limit && col.blue()>=limit && col.green()>=limit;
|
||||
}
|
||||
|
||||
static bool inline isVeryLight(const QColor &col)
|
||||
static bool inline isVeryDark(const QColor &col, int limit=80)
|
||||
{
|
||||
return col.red()>=240 && col.blue()>=240 && col.green()>=240;
|
||||
return col.red()<limit && col.blue()<limit && col.green()<limit;
|
||||
}
|
||||
|
||||
static bool inline isVeryDark(const QColor &col)
|
||||
static QColor clampColor(const QColor &color, int darkLimit=80, int darkValue=64, int lightLimit=240, int lightValue=240)
|
||||
{
|
||||
return col.red()<40 && col.blue()<40 && col.green()<40;
|
||||
}
|
||||
|
||||
static QColor clampColor(const QColor &color)
|
||||
{
|
||||
return isVeryLight(color)
|
||||
? QColor(240, 240, 240)
|
||||
: isVeryDark(color)
|
||||
? QColor(40, 40, 40)
|
||||
return isVeryLight(color, lightLimit)
|
||||
? QColor(lightValue, lightValue, lightValue)
|
||||
: isVeryDark(color, darkLimit)
|
||||
? QColor(darkValue, darkValue, darkValue)
|
||||
: color;
|
||||
}
|
||||
|
||||
@@ -170,12 +165,7 @@ static QPixmap createMenuIconPixmap(int size, QColor col, double opacity=1.0)
|
||||
|
||||
static void calcIconColors(QColor &stdColor, QColor &highlightColor)
|
||||
{
|
||||
stdColor=QApplication::palette().color(QPalette::Active, QPalette::ButtonText);
|
||||
if (isLight(stdColor)) {
|
||||
stdColor=QColor(200, 200, 200);
|
||||
} else if (isDark(stdColor)) {
|
||||
stdColor=Qt::black;
|
||||
}
|
||||
stdColor=clampColor(QApplication::palette().color(QPalette::Active, QPalette::ButtonText), 80, 48);
|
||||
highlightColor=isLight(stdColor) ? stdColor.lighter(constShadeFactor) : stdColor.darker(constShadeFactor);
|
||||
}
|
||||
|
||||
@@ -218,12 +208,7 @@ static Icon createMenuIcon(const QColor &stdColor, const QColor &highlightColor)
|
||||
return icon;
|
||||
}
|
||||
|
||||
static unsigned char checkBounds(int num)
|
||||
{
|
||||
return num < 0 ? 0 : (num > 255 ? 255 : num);
|
||||
}
|
||||
|
||||
static void adjustPix(QImage &img, const QColor &col, double opacity)
|
||||
static void recolourPix(QImage &img, const QColor &col, double opacity=1.0)
|
||||
{
|
||||
unsigned char *data=img.bits();
|
||||
int numChannels=4;
|
||||
@@ -238,43 +223,9 @@ static void adjustPix(QImage &img, const QColor &col, double opacity)
|
||||
|
||||
for(int row=0; row<h; ++row) {
|
||||
for(int column=0; column<width; column+=numChannels) {
|
||||
unsigned char source=data[offset+column+1];
|
||||
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
/* ARGB */
|
||||
data[offset+column]*=opacity;
|
||||
data[offset+column+1] = checkBounds(r-source);
|
||||
data[offset+column+2] = checkBounds(g-source);
|
||||
data[offset+column+3] = checkBounds(b-source);
|
||||
#else
|
||||
/* BGRA */
|
||||
data[offset+column] = checkBounds(b-source);
|
||||
data[offset+column+1] = checkBounds(g-source);
|
||||
data[offset+column+2] = checkBounds(r-source);
|
||||
data[offset+column+3]*=opacity;
|
||||
#endif
|
||||
}
|
||||
offset+=stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void recolourPix(QImage &img, const QColor &col)
|
||||
{
|
||||
unsigned char *data=img.bits();
|
||||
int numChannels=4;
|
||||
int w=img.width();
|
||||
int h=img.height();
|
||||
int stride=img.bytesPerLine();
|
||||
int r=col.red();
|
||||
int g=col.green();
|
||||
int b=col.blue();
|
||||
int width=w*numChannels;
|
||||
int offset=0;
|
||||
|
||||
for(int row=0; row<h; ++row) {
|
||||
for(int column=0; column<width; column+=numChannels) {
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
/* ARGB */
|
||||
data[offset+column+1] = r;
|
||||
data[offset+column+2] = g;
|
||||
data[offset+column+3] = b;
|
||||
@@ -283,6 +234,7 @@ static void recolourPix(QImage &img, const QColor &col)
|
||||
data[offset+column] = b;
|
||||
data[offset+column+1] = g;
|
||||
data[offset+column+2] = r;
|
||||
data[offset+column+3]*=opacity;
|
||||
#endif
|
||||
}
|
||||
offset+=stride;
|
||||
@@ -296,7 +248,7 @@ static QPixmap recolour(const QImage &img, const QColor &col, double opacity=1.0
|
||||
i=i.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
|
||||
adjustPix(i, col, opacity);
|
||||
recolourPix(i, col, opacity);
|
||||
return QPixmap::fromImage(i);
|
||||
}
|
||||
|
||||
@@ -389,12 +341,13 @@ static void updateSidebarIcon(Icon &i, const QString &name, const QColor &color,
|
||||
} else if (isVeryLight(color)) {
|
||||
i.addFile(":sidebar-"+name+"-white", QSize(), mode);
|
||||
} else { // Neither black nor white, so we need to rcolour...
|
||||
i.addFile(":sidebar-"+name, QSize(), mode);
|
||||
Icon std;
|
||||
std.addFile(":sidebar-"+name, QSize(), mode);
|
||||
// Now recolour the icon!
|
||||
QList<int> sizes=QList<int>() << 16 << 22 << 32 << 48 << 64;
|
||||
QColor col=clampColor(color);
|
||||
foreach (int s, sizes) {
|
||||
QImage img=i.pixmap(s, s, mode).toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
QImage img=std.pixmap(s, s, mode).toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
recolourPix(img, col);
|
||||
i.addPixmap(QPixmap::fromImage(img), mode);
|
||||
}
|
||||
|
||||