alias crayola { %br.sz = 22 _window var %f = farger.inc var %i = 1, %r, %n = $lines(%f), %j = 0 e %n while (%i <= %n) { %r = $read(%f,n,%i) ; e $gettok(%r,5,32) if (*>;* iswm %r) thumbnail $remove($gettok(%r,5-,32),$chr(32)) %i else inc %j inc %i } e $calc(%n - %j)significant colors ; drawsave @board crayola.jpg } alias _window { %br.w = $window(-1).w dec %br.w 70 %br.h = $window(-1).h if ($window(@board) == $null) window -pd +d @board 0 0 %br.w %br.h else window -a @board drawrect -f @board 10 1 0 0 %br.w %br.h } alias thumbnail { var %sz = %br.sz, %fitall = 0 var %c = $left($right($1,-1),-2) var %r = $calc($gettok(%c,1,44) * 255) var %g = $calc($gettok(%c,2,44) * 255) var %b = $calc($gettok(%c,3,44) * 255) %c = $rgb(%r,%g,%b) var %m = $calc($int($calc(%br.w / %sz)) - %fitall) var %x = $calc((($2 - 1) % %m) * %sz) var %y = $calc($int($calc(($2 - 1) / %m)) * %sz) if (%y < %br.h) drawrect -fr @board %c 1 %x %y %sz %sz } menu @board { sclick: clipname } alias -l e echo -s : $1- alias clipname { var %sz = %br.sz, %fitall = 0 var %m = $calc($int($calc(%br.w / %sz)) - %fitall) ; e %m MMMM if ($mouse.x > $calc(%sz * %m)) { e off edge | halt } var %x = $calc($int($calc($mouse.x / %sz)) + 1) var %y = $int($calc($mouse.y / %sz)) var %f = farger.inc var %i = $calc(%m * %y + %x) var %r = $read(%f,n,%i) ; e %i if (%i > $lines(%f)) { e no more colors | halt } if (*>;* iswm %r) { clipboard $gettok(%r,2,32) actvmirc e $gettok(%r,2,32) $remove($gettok(%r,5-,32),$chr(32)) } else e not a color } alias actvmirc { window -p +d @tmp 0 0 90 90 window -a @tmp close -@ @tmp }