Najeebsk

COLOR-PICK.ahk

Dec 31st, 2021 (edited)
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. version:=2.0
  2. #SingleInstance force
  3. SetBatchLines, -1
  4. Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
  5. WM_MOUSEMOVE := 0x200
  6.  
  7. onmessage(WM_MOUSEMOVE, "OnMouseMove")
  8.  
  9. red:=["FF9999","FF6666","FF3333","FF0000","D90000","B20000","8C0000","660000","400000"]
  10. flame:=["FFB299","FF8C66","FF6633","FF4000","D93600","B22D00","8C2300","661A00","401000"]
  11. orange:=["FFCC99","FFB266","FF9933","FF8000","D96C00","B25900","8C4600","663300","402000"]
  12. amber:=["FFE599","FFD966","FFCC33","FFBF00","D9A300","B28600","8C6900","664D00","403000"]
  13. yellow:=["FFFF99","FFFF66","FFFF33","FFFF00","D9D900","B2B200","8C8C00","666600","404000"]
  14. lime:=["E5FF99","D9FF66","CCFF33","BFFF00","A3D900","86B200","698C00","4D6600","304000"]
  15. chartreuse:=["CCFF99","B2FF66","99FF33","80FF00","6CD900","59B200","468C00","336600","204000"]
  16. green:=["99FF99","66FF66","33FF33","00FF00","00D900","00B200","008C00","006600","004000"]
  17. sea:=["99FFCC","66FFB2","33FF99","00FF80","00D96C","00B259","008C46","006633","004020"]
  18. turquoise:=[ "99FFE5","66FFD9","33FFCC","00FFBF","00D9A3","00B286","008C69","00664D","004030"]
  19. cyan:=["99FFFF","66FFFF","33FFFF","00FFFF","00D9D9","00B2B2","008C8C","006666","004040"]
  20. sky:=["99E5FF","66D9FF","33CCFF","00BFFF","00A3D9","0086B2","00698C","004D66","003040"]
  21. azure:=["99CCFF","66B2FF","3399FF","0080FF","006CD9","0059B2","00468C","003366","002040"]
  22. blue:=["9999FF","6666FF","3333FF","0000FF","0000D9","0000B2","00008C","000066","000040"]
  23. han:=["B299FF","8C66FF","6633FF","4000FF","3600D9","2D00B2","23008C","1A0066","100040"]
  24. violet:=["CC99FF","B266FF","9933FF","8000FF","6C00D9","5900B2","46008C","330066","200040"]
  25. purple:=["E599FF","D966FF","CC33FF","BF00FF","A300D9","8600B2","69008C","4D0066","300040"]
  26. fuchsia:=["FF99FF","FF66FF","FF33FF","FF00FF","D900D9","B200B2","8C008C","660066","400040"]
  27. magenta:=["FF99E5","FF66D9","FF33CC","FF00BF","D900A3","B20086","8C0069","66004D","400030"]
  28. pink:=["FF99CC","FF66B2","FF3399","FF0080","D9006C","B20059","8C0046","660033","400020"]
  29. crimson:=["FF99B2","FF668C","FF3366","FF0040","D90036","B2002D","8C0023","66001A","400010"]
  30. gray:=["DEDEDE","BFBFBF","9E9E9E","808080","666666","4D4D4D","333333","1A1A1A","000000"]
  31. sepia:=["DED3C3","BFAB8F","9E8664","806640","665233","4D3D26","33291A","1A140D","000000"]
  32.  
  33. colors:=["Red","Flame","Orange","Amber","Yellow","Lime","Chartreuse","Green","Sea","Turquoise","Cyan","Sky","Azure","Blue","Han","Violet","Purple","Fuchsia","Magenta","Pink","Crimson","Gray","Sepia"]
  34.  
  35. gui, font, s11, consolas
  36. gui, font, csilver bold
  37.  
  38. creategrid(ctr:="text", clln:="3_", cmj:=false, gpx:=100+10+5, gpy:=1, cols:=9, rows:=1, wsp:=24, hsp:="24", opt:=" w24 h24 goutcol  BackGroundTrans -border -disabled 0x201", fill:="2")
  39. creategrid(ctr:="text", clln:="1_", cmj:=false, gpx:=10, gpy:=25, cols:=1, rows:=23, wsp:=100, hsp:="24", opt:=" w100 h24  BackGroundTrans goutpal -border -disabled 0x201 right", fill:=" colors")
  40. creategrid(ctr:="text", clln:="2_", cmj:=false, gpx:=gpx+wsp+5, gpy:=25, cols:=9, rows:=23, wsp:="24", hsp:="24", opt:=" w24 h24 border ghello", fill:="100")
  41. creategrid(ctr:="listview", clln:="", cmj:=false, gpx, gpy:=25, cols:=9, rows:=23, wsp:="24", hsp:="24", opt:=" w24 h25  Backgroundff0000 -Hdr -E0x200", fill:="")
  42.  
  43.  
  44. for i, r in colors {
  45.     drawchar("1_" i "_" 1, r " ")
  46.         for j, c in %r% {
  47.             ColorListview( i "_" j, c)
  48.             cell:= "2_" i "_" j
  49.             %cell%:=c
  50.         }
  51. }
  52.  
  53. loop, 9
  54.     drawchar("3_1_" a_index, a_index)
  55.  
  56. gui, color, black
  57. gui, show,, %  "Color PICK v" . version "  - by Najeeb"
  58.  
  59. return
  60.  
  61. guicontextmenu:
  62. if (strsplit(a_guicontrol,"_").1=2)
  63. gosub, hello
  64. return
  65.  
  66. hello:
  67. Traytip, Quick Palette:, % "#" %a_guicontrol%  " picked"
  68. clipboard:= % %a_guicontrol%
  69.  
  70. exit:
  71. gui, hide
  72. tooltip,
  73. sleep, 2000
  74. exitapp
  75. return
  76.  
  77. outpal:
  78. rowselect:=strsplit(a_guicontrol,"_").2
  79.  
  80. outcolor:=colors[rowselect]
  81.  
  82.  
  83. for k, v in %outcolor%
  84.     out .= k ":" """" v """" ","
  85. out:=rtrim(out, ",")
  86. out:=outcolor ":={" out "}"
  87. gui, hide
  88.  
  89. clipboard:= out
  90. Traytip, Quick Palette:, % outcolor  " picked"
  91. gosub, exit
  92. return
  93.  
  94. outcol:
  95. colselect:=strsplit(a_guicontrol,"_").3
  96. for k, v in colors
  97.     out .=  v  ":" """"  %v%[3]  """" ","
  98. out:=rtrim(out, ",")
  99. out:="Shade" colselect " := {" out "}"
  100. clipboard:= out
  101. Traytip, Quick Palette:, % "Shade" colselect  " picked"
  102. gosub, exit
  103. return
  104.  
  105. OnMouseMove() {
  106.     if (a_guicontrol)
  107. tooltip, %  %a_guicontrol%
  108.     else
  109.         tooltip,
  110. }
  111. return
  112.  
  113. guiclose:
  114. esc::
  115. exitapp
  116. return
  117.  
  118. creategrid(ctr:="pic", clln:="", cmj:="true", gpx:=10, gpy:=10, cols:=30, rows:=20, wsp:="32", hsp:="32", opt:=" BackGroundTrans  -disabled", fill:="X") {
  119.   global
  120.   r:=0,  c:=0
  121.      While r++ < rows {
  122.         while c++ < cols{
  123.                   gui 1: add, % ctr, % opt " v" ((cmj) ? (clln c "_" r " Hwndh" clln  c "_" r):(clln r "_" c " Hwndh" clln  r "_" c)) ((c=1 && r=1) ? " x"gpx " y"gpy " section"
  124.                : (c!=1 && r=1) ? " xp+"wsp " yp" : (c=1 && r!=1) ? " xs" " yp+"hsp : " xp+"wsp " yp"), % fill
  125.           } c:=0
  126.      } r:=c:=0
  127. }
  128.  
  129. drawchar(varname, chartodraw:="@", color:="")
  130. {
  131.  global
  132. guicontrol,, %varname%, %chartodraw%
  133. if (color)
  134. colorcell(varname, color)
  135. }
  136.  
  137. ColorCell(cell_to_paint, color:="red")
  138. {
  139.  GuiControl, +c%color%  , %cell_to_paint%
  140.  GuiControl, MoveDraw, % cell_to_paint
  141. }
  142.  
  143. ColorListview(cell_to_paint, color:="red")
  144. {
  145.  GuiControl, +background%color%  , %cell_to_paint%
  146.  GuiControl, MoveDraw, % cell_to_paint
  147. }
  148.  
  149.  
Add Comment
Please, Sign In to add comment