Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. alias colors {
  3. if (!$window(@colors)) { window -Bpdf +t @colors -1 -1 1530 255 }
  4. if (!$window(@luminosity)) { window -Bpdf +t @luminosity -1 -1 510 16 }
  5. var %y 0
  6. while %y < 255 {
  7. var %x 0
  8. while %x < 1530 {
  9. if %x isnum 0-255 {
  10. set %red $floor($calc(255 -128 / 255 * %y))
  11. set %green $floor($calc(%x + (127 - %x) / 255 * %y))
  12. set %blue $floor($calc(127 / 255 * %y))
  13. }
  14. elseif %x isnum 256-510 {
  15. set %red $floor($calc((255 - (%x - 255)) + (127 - (255 - (%x - 255))) / 255 * %y))
  16. set %green $floor($calc(255 -128 / 255 * %y))
  17. set %blue $floor($calc(127 / 255 * %y))
  18. }
  19. elseif %x isnum 511-765 {
  20. set %red $floor($calc(127 / 255 * %y))
  21. set %green $floor($calc(255 -128 / 255 * %y))
  22. set %blue $floor($calc((%x - 510) + (127 - (%x - 510)) / 255 * %y))
  23. }
  24. elseif %x isnum 766-1020 {
  25. set %red $floor($calc(127 / 255 * %y))
  26. set %green $floor($calc((255 - (%x - 765)) + (127 - (255 - (%x - 765))) / 255 * %y))
  27. set %blue $floor($calc(255 -128 / 255 * %y))
  28. }
  29. elseif %x isnum 1021-1275 {
  30. set %red $floor($calc((%x - 1020) + (127 - (%x - 1020)) / 255 * %y))
  31. set %green $floor($calc(127 / 255 * %y))
  32. set %blue $floor($calc(255 -128 / 255 * %y))
  33. }
  34. elseif %x isnum 1276-1530 {
  35. set %red $floor($calc(255 -128 / 255 * %y))
  36. set %green $floor($calc(127 / 255 * %y))
  37. set %blue $floor($calc((255 - (%x - 1275)) + (127 - (255 - (%x - 1275))) / 255 * %y))
  38. }
  39. drawdot -r [ $+ [ $iif($1,n) ] ] @colors $rgb(%red,%green,%blue) 1 %x %y
  40. inc %x
  41. }
  42. inc %y
  43. }
  44. $iif($1,drawdot @colors)
  45. }
  46. alias -l drawcolor {
  47. if (!$window(@luminosity)) { window -Bpdf +t @luminosity -1 -1 510 16 }
  48. tokenize 44 $1
  49. var %x 0
  50. while %x < 500 {
  51. drawline -rn @luminosity $rgb($floor($calc($iif(%x > 255,$1 +) ($iif(%x > 255,255 -) $1) / 255 * (%x $iif(%x > 255,- 255)))),$floor($calc($iif(%x > 255,$2 +) ($iif(%x > 255,255 -) $2) / 255 * (%x $iif(%x > 255,- 255)))),$floor($calc($iif(%x > 255,$3 +) ($iif(%x > 255,255 -) $3) / 255 * (%x $iif(%x > 255,- 255))))) 1 %x 0 %x 10
  52. inc %x
  53. }
  54. drawdot @luminosity
  55. }
  56. menu @colors {
  57. sclick:echo -s Color: $getdot(@colors,$mouse.x,$mouse.y)) RGB: $rgb($getdot(@colors,$mouse.x,$mouse.y)) | drawcolor $rgb($getdot(@colors,$mouse.x,$mouse.y))
  58. }
  59. menu @luminosity {
  60. sclick:echo -s Color: $getdot(@luminosity,$mouse.x,$mouse.y)) RGB: $rgb($getdot(@luminosity,$mouse.x,$mouse.y))
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement