-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColorArray.ahk
More file actions
77 lines (58 loc) · 1.74 KB
/
ColorArray.ahk
File metadata and controls
77 lines (58 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#Requires AutoHotkey v2.0
A_MenuMaskKey := "vkFF" ; mask Alts with dummy key (instead of Ctrl)
class ColorArray extends Array {
prefix := False ; should colors include the "0x" prefix?
mode := "" ; PixelGetColor retrieval ("Alt" or "Slow")
__New(pre := False, ValueN*) {
this.prefix := pre
super.__New(ValueN*)
}
static MouseColor(pre := False, mode := unset) { ; color under cursor
MouseGetPos &x, &y
return SubStr(PixelGetColor(x, y, mode?), 3 - (pre*2))
}
InsertAt(Index) {
mc := this.MouseColor
super.InsertAt(Index, mc)
return mc
}
Push() {
mc := this.MouseColor
super.Push(mc)
return mc
}
ToString() { ; Comma-separated values
out := ""
for value in this {
out .= "," value
}
return SubStr(out, 2)
}
MouseColor => ColorArray.MouseColor(this.prefix, this.mode)
}
^!LButton::Run "https://volumecolor.io/editor?swatches=" ColorGetList()
*LButton::PushTip()
Hotkey "*LButton", "Off" ; initial state
ColorGetList() {
global coIns := ColorArray()
PushTip()
Hotkey "^!LButton", "Off" ; else it overrides *LButton
Hotkey "*LButton" , "On"
SetTimer cTip() => ToolTip(coIns.MouseColor), 15
Loop { ; until Ctrl & Alt are up simultaneously
KeyWait "Ctrl"
KeyWait "Alt"
} Until !GetKeyState("Ctrl")
Hotkey "*LButton" , "Off"
SetTimer cTip, 0
ToolTip
Hotkey "^!LButton", "On"
return String(coIns)
}
PushTip() {
global coIns
mc := coIns.Push()
MouseGetPos &x, &y
ToolTip mc, x+16, y-23, 2
SetTimer () => ToolTip(,,,2), -500
}