Icon style (colorized or grayscale), part 1

This commit is contained in:
2026-11-06 16:00:27 +00:00
parent 1c43c4b4bd
commit ecde38f9e8
3 changed files with 10 additions and 2 deletions
+2 -1
View File
@@ -724,7 +724,7 @@ func drawAppGlyph(hdc uintptr, r rect, a appWin) {
isz := px(16) // the small taskbar icon size
if a.icon != 0 {
cx, cy := center(r)
pDrawIconEx.Call(hdc, uintptr(cx-isz/2), uintptr(cy-isz/2), a.icon, uintptr(isz), uintptr(isz), 0, 0, diNormal)
pDrawIconEx.Call(hdc, uintptr(cx-isz/2), uintptr(cy-isz/2), styledIcon(a.icon), uintptr(isz), uintptr(isz), 0, 0, diNormal)
} else if rs := []rune(a.title); len(rs) > 0 {
pSetBkMode.Call(hdc, transparent)
pSetTextColor.Call(hdc, rgb(245, 245, 245))
@@ -1218,6 +1218,7 @@ func main() {
loadOrient()
loadPinned()
loadOrderKeys()
loadIconMode()
hdc, _, _ := pGetDC.Call(0)
dpi, _, _ := pGetDeviceCaps.Call(hdc, logPixelsX)
+3
View File
@@ -333,6 +333,9 @@ func refreshApps(refreshIcons bool) bool {
}
}
}
if changed {
styleCacheClear() // icon handles can be reused by other icons
}
apps = next
return changed
}
+5 -1
View File
@@ -71,7 +71,8 @@ func colorOf(i int) uintptr {
i = 0
}
c := palette[i]
return rgb(c.r, c.g, c.b)
r, g, b := styleColor(c.r, c.g, c.b)
return rgb(r, g, b)
}
func logoColor() uintptr { return colorOf(logoIdx) }
@@ -130,6 +131,7 @@ func addColorMenus(menu uintptr) {
build(menuLogoColorBase, logoIdx, "Windows logo color")
build(menuClockColorBase, clockIdx, "Clock color")
build(menuIconColorBase, iconIdx, "Tray icon color")
addStyleMenu(menu)
}
func handleColorCommand(cmd uintptr) bool {
@@ -141,6 +143,8 @@ func handleColorCommand(cmd uintptr) bool {
clockIdx = int(cmd - menuClockColorBase)
case cmd >= menuIconColorBase && cmd < menuIconColorBase+n:
iconIdx = int(cmd - menuIconColorBase)
case handleStyleCommand(cmd):
return true
default:
return false
}