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 = $round($calc($gettok(%c,1,44) * 255),0) var %g = $round($calc($gettok(%c,2,44) * 255),0) var %b = $round($calc($gettok(%c,3,44) * 255),0) %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 sclick: mouseover ; mouse: mouseover dont suppose it can open and close windows that fast mouse: mouseover2 } alias -l e echo -s : $1- alias getname { 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) if (%i > $lines(%f)) { e no more colors | halt } e line: %i return %r } alias clipname { var %r = $getname if (*>;* iswm %r) { clipboard $gettok(%r,2,32) ; actvmirc popups $gettok(%r,2,32) 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 } alias popups { var %w = $calc(8 * $len($1-)) if ($window(@pop)) { .timer.pop off | window -c @pop } .timer.pop 1 10 window -c @pop window -pd +d @pop $mouse.x $mouse.y %w 20 drawrect -f @pop 1 2 0 0 %w 20 drawtext -r @pop 16777215 Arial 12 4 2 $1 } alias mouseover { if (!$fopen(crayola)) .fopen crayola farger.inc var %r = $fgetname(1) var %w = $calc(8 * $len(%r)) if ($window(@pop)) { .timer.pop off | window -c @pop } .timer.pop 1 6 window -c @pop window -pd +d @pop $mouse.x $calc($mouse.y + %br.sz) %w 20 drawrect -f @pop 1 2 0 0 %w 20 drawtext -r @pop 16777215 Arial 12 4 2 %r ; free mem in 60 if (!$timer(.close).com) .timer.close 1 60 fclose crayola } alias fgetname { var %sz = %br.sz, %fitall = 0 var %m = $calc($int($calc(%br.w / %sz)) - %fitall) if ($mouse.x > $calc(%sz * %m)) return off edge var %x = $calc($int($calc($mouse.x / %sz)) + 1) var %y = $int($calc($mouse.y / %sz)) var %i = $calc(%m * %y + %x) if (%i > $lines(farger.inc)) return no more colors .fseek -l crayola %i %r = $fread(crayola) if (*>;* iswm %r) { if ($1) clipboard $gettok(%r,2,32) return $gettok(%r,2,32) } else return not a color } alias mouseover2 { if (!$fopen(crayola)) .fopen crayola farger.inc var %r = $fgetname(0) var %w = $calc(8 * $len(%r)) tokenize 32 $thumbend drawrect -f @board 1 2 $1 $2 245 20 drawtext -r @board 16777215 Arial 12 $1 $2 %r ; free mem in 60 if (!$timer(.close).com) .timer.close 1 60 fclose crayola } alias thumbend { var %n = $lines(farger.inc) var %fitall = 0 var %m = $calc($int($calc(%br.w / %br.sz)) - %fitall) var %y = $calc($int($calc(%n / %m)) * %br.sz) var %x = $calc((%n % %m) * %br.sz) return %x %y }