T64177 Toolbar icon theming support.

The patch adds a theme option for "inverting" toolbar icon colors.

**More optimized shader.**

Source: https://gamedev.stackexchange.com/questions/59797/

uniform float factor; in vec2 texCoord_interp; out vec4 fragColor; uniform vec4 color; uniform sampler2D image; void main() { vec4 tex = texture(image, texCoord_interp); vec3 c; // unpremultiply alpha if (tex.a == 0.0 || tex.a == 1.0) { c = tex.rgb; } else { c = tex.rgb / tex.a; } // invert c = 1.0 - c.rgb; // rgb to hsv vec4 k = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); vec4 p = mix(vec4(c.bg, k.wz), vec4(c.gb, k.xy), step(c.b, c.g)); vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); float d = q.x - min(q.w, q.y); float e = 1.0e-10; vec3 hsv = vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); // hue offset hsv.x += 0.5; if (hsv.x > 1.0f) { hsv.x -= 1.0f; } else if (hsv.x < 0.0f) { hsv.x += 1.0f; } // hsv to rgb vec4 r = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec3 t = abs(fract(hsv.xxx + r.xyz) * 6.0 - r.www); c.rgb = hsv.z * mix(r.xxx, clamp(t - r.xxx, 0.0, 1.0), hsv.y); // premultiply alpha tex = vec4(c.rgb * tex.a, tex.a); // desaturate tex.rgb = ((0.3333333 * factor) * vec3(tex.r + tex.g + tex.b)) + (tex.rgb * (1.0 - factor)); fragColor = tex * color; }