How to customize the Color/Theme of the GUI?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
GamesOfFreak
Posts: 28
Joined: 15 Sep 2020, 03:51
Location: Germany
Contact:

How to customize the Color/Theme of the GUI?

Post by GamesOfFreak » 21 May 2023, 13:26

How can I customize the Colors/Theme of the entire GUI?

I'm a little stuck with this.


GamesOfFreak
Posts: 28
Joined: 15 Sep 2020, 03:51
Location: Germany
Contact:

Re: How to customize the Color/Theme of the GUI?

Post by GamesOfFreak » 21 May 2023, 13:49

Is there a Function/Script that allows us to customize the Theme?

WKen
Posts: 202
Joined: 21 Feb 2023, 00:01

Re: How to customize the Color/Theme of the GUI?

Post by WKen » 21 May 2023, 15:32

image.png
image.png (22.99 KiB) Viewed 786 times

Rohwedder
Posts: 7774
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to customize the Color/Theme of the GUI?

Post by Rohwedder » 22 May 2023, 03:15

Hallo,
I had once played around with a script from jNizM.
Maybe helpful?:

Code: Select all

#Requires AutoHotkey v2.0
;based on jNizM https://www.autohotkey.com/boards/viewtopic.php?p=303131#p303131
MyGui := Gui(, "Test")
MyGui.BackColor := 000000

hTx1 := MyGui.Add("Text", "BackgroundCFD8DC", "Edit Control:")
hTx1.SetFont("c263238")

hEdt1 := MyGui.Add("Edit", "w400 r5 BackgroundE1BEE7", "Edit 1`nEdit 2`nEdit 3")
hEdt1.SetFont("c4A148C")

hEdt2 := MyGui.Add("Edit", "w400 r5", "Edit 1`nEdit 2`nEdit 3")
hEdt2.SetFont("c0000FF")
hEdt2.Opt("Background00FFFF")

MyGui.Add("Text", "BackgroundCFD8DC", "ComboBox Control:").SetFont("c263238")
MyGui.Add("Combobox", "w400 BackgroundBBDEFB", ["Combo 1||Combo 2|Combo 3|Combo 4"]).SetFont("c0D47A1")

MyGui.Add("Text", "BackgroundCFD8DC", "ListBox Control:").SetFont("c263238")
MyGui.Add("ListBox", "w400 r4 BackgroundB2DFDB", ["ListBox 1||ListBox 2|ListBox 3|ListBox 4"]).SetFont("c004D40")

MyGui.Add("Text", "BackgroundCFD8DC", "DropDownList Control:").SetFont("c263238")
MyGui.Add("DropDownList", "w400 r4 BackgroundF0F4C3", ["DropDownList 1||DropDownList 2|DropDownList 3|DropDownList 4"]).SetFont("c827717")

MyGui.Add("Text", "BackgroundCFD8DC", "DropDownList Control (default):").SetFont("c263238")
MyGui.Add("DropDownList", "w400 r4", ["DropDownList 1||DropDownList 2|DropDownList 3|DropDownList 4"]).SetFont("c827717")

MyGui.Add("Text", "BackgroundCFD8DC", "ListView Control:").SetFont("c263238")
;MyGui.SetFont("cE65100") ; works like the cXXXXXX option for LV
LV := MyGui.Add("ListView", "w400 r10 BackgroundFFE0B2 cE65100", ["Col 1|Col 2|Col 3"]) ; .SetFont("") is not possible here
loop 5
	LV.Add(, A_Index, A_Index * 2, A_Index * 3)

MyGui.Add("Button",, "Change Color").OnEvent("Click", ChangeCtlColors) ; there is a white border around Buttons? Possible workaround -> WM_CTLCOLORBTN()

MyGui.OnEvent("Close", DeleteObjects)
MyGui.Show()

ChangeCtlColors(this, *)
{
	global hEdt2 ; does I really need a global here to act with gui controls?
	hEdt2.Opt("BackgroundE7BEE1")
	hEdt2.SetFont("cFF0000")
}

DeleteObjects(this, *)
{
	if IsSet(hBrush)
		DllCall("gdi32\DeleteObject", "ptr", hBrush)
}

WM_CTLCOLORBTN(*) ; this should be a build-in default for Button-Borders
{
	global hBrush
	static init   := OnMessage(0x0135, "WM_CTLCOLORBTN")
	return hBrush := DllCall("gdi32\CreateSolidBrush", "uint", 0x000000, "uptr")
}

GamesOfFreak
Posts: 28
Joined: 15 Sep 2020, 03:51
Location: Germany
Contact:

Re: How to customize the Color/Theme of the GUI?

Post by GamesOfFreak » 24 May 2023, 06:59

WKen wrote:
21 May 2023, 15:32
image.png
I tried this line of code but I don't see any Changes of the GUI Theme.

WKen
Posts: 202
Joined: 21 Feb 2023, 00:01

Re: How to customize the Color/Theme of the GUI?

Post by WKen » 24 May 2023, 07:34

That's dark mode, some controls don't support it. Check out Rohwedder's post.

Post Reply

Return to “Ask for Help (v2)”