All pastes #742858 Raw Edit

Color script

public text v1 · immutable
·published 2007-10-19 21:42 UTC
rendered paste body
;Color script by Naruto1783
;Color codes provided by the good folks on Hawkee.com
;Enjoy!
alias csc { dialog -md typec typec }
#color on
dialog typec {
  title "Color by Naruto1783"
  size -1 -1 140 140
  option dbu
  box "Color 1", 1, 70 90 30 25
  box "Color 2", 2, 105 90 30 25
  check "Single Color", 3, 5 90 41 7
  check "Color w/ BG", 4, 5 100 40 7 
  check "Random Color", 5, 5 110 30 7
  check "Alternating Color w/ BG", 6, 5 130 65 7
  check "Alternating Color", 7, 5 120 50 7
  combo 8, 74 99 23 50, size drop 
  combo 9, 109 99 23 50, size drop
  button "Set", 10, 81 130 12 7, ok
  button "Cancel", 11, 115 130 20 7, cancel
  check "Bold", 12, 74 118 20 7
  text "This is a color script by Naruto1783. Select the type of color you would like to use and then choose the appropriate color for your use, using the chart below. Click set to enable it. Enjoy!" 13, 5 1 130 27
  button "Reset" 15, 95 130 18 7
  text "0 white     8 yellow", 16, 5 31 50 7
  text "1 black     9 lightgreen", 17, 5 38 60 7
  text "2 blue      10 cyan", 18, 5 45 50 7
  text "3 green     11 lightcyan", 19, 5 52 60 7
  text "4 lightred  12 lightblue", 20, 5 59 60 7
  text "5 brown     13 pink", 21, 5 66 50 7
  text "6 purple    14 grey", 22, 5 73 50 7
  text "7 orange    15 lightgrey", 23, 5 80 60 7
  link "http://www.hawkee.com/", 24, 66 55 60 7
  link "mini_logo_62@hotmail.com", 25, 66 80 55 7
  text "Email me with any comments, questions, or suggestions.", 26, 66 65 70 15 
  text "Thanks to folks on Hawkee.com with coding the majority of color codes.", 27, 66 33 70 20
  text "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯", 28, 3 27 135 4
}
on *:dialog:typec:init:0:{
  var %f 0
  while (%f <= 15) {
    if ($len(%f) < 2) {   
      did -a typec 8,9 $+(0,%f)
      inc %f
    }
    else {
      did -a typec 8,9 %f
      inc %f
    }
  }
}
on *:dialog:typec:sclick:3:{
  did -b typec 4,5,6,7,9
} 
on *:dialog:typec:sclick:4:{
  did -b typec 3,5,6,7
}
on *:dialog:typec:sclick:5:{
  did -b typec 3,4,6,7,8,9
}
on *:dialog:typec:sclick:6:{
  did -b typec 3,4,5,7
}
on *:dialog:typec:sclick:7:{
  did -b typec 3,4,5,6
}
on *:dialog:typec:sclick:15:{
  did -eu typec 3,4,5,6,7,8,9
}
on *:dialog:typec:sclick:11:{
  .disable #color
}
on *:dialog:typec:sclick:10:{
  set %bold $did(12).state  
  if ($did(3).state == 1) && ($did(12).state == 0) {
    .enable #single    
    set %sc $did(8).seltext 
  }
  if ($did(3).state == 1) && ($did(12).state == 1) {
    .enable #bs    
    set %sc $did(8).seltext
  }
  if ($did(4).state == 1) && ($did(12).state == 0) {
    .enable #cwb    
    set %bg1 $did(8).seltext
    set %bg2 $did(9).seltext
  }
  if ($did(4).state == 1) && ($did(12).state == 1) {
    .enable #withbb    
    set %bg1 $did(8).seltext
    set %bg2 $did(9).seltext
  }
  if ($did(5).state == 1) && ($did(12).state == 0) {
    .enable #r
  }
  if ($did(5).state == 1) && ($did(12).state == 1) {
    .enable #randomb
  }
  if ($did(6).state == 1) && ($did(12).state == 0) {
    .enable #acb    
    set %ab1 $did(8).seltext
    set %ab2 $did(9).seltext
  }
  if ($did(6).state == 1) && ($did(12).state == 1) {
    .enable #backaltb    
    set %ab1 $did(8).seltext
    set %ab2 $did(9).seltext
  }
  if ($did(7).state == 1) && ($did(12).state == 0) {
    .enable #ac    
    set %a1 $did(8).seltext
    set %a2 $did(9).seltext
  }
  if ($did(7).state == 1) && ($did(12).state == 1) {
    .enable #altb    
    set %a1 $did(8).seltext
    set %a2 $did(9).seltext
  }
}
#color end
#cwb off
;color w/ background
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) { 
    var %x =  $+ %bg1  
    var %z = %bg2    
    say %x $+ , $+ %z $+ $1- 
    halt 
  } 
}
#cwb end
#r off
;random color
on *:input:*: { 
  var %r = $r(1,15)  
  if (/* !iswm $1) && (!$ctrlenter) && ($len(%r) < 2) { 
    var %c = $+(0,,,%r)    
    say $+($chr(3),%c,$1-) 
    halt  
  }
  elseif (/* !iswm $1) && (!$ctrlenter) {
    say $+($chr(3),%r,$1-)
    halt  
  } 
}
#r end
#single off
;single color
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) { 
    say $+(,%sc,$1-,) 
    halt 
  } 
}
#single end
#ac off
;alternating color
alias ctalker { 
  var %x 
  .echo -q $regsub($1,/(.)(.?)/g, $+ %a1 $+ \1 $+ %a2 $+ \2,%x) 
  return %x 
} 
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) && (!$inpaste) { 
    say $$ctalker($1-) 
    halt 
  } 
} 
#ac end
#acb on
;alternating color w/ background
alias ctalker { 
  var %x =  $+ %ab1 $+ , $+ %ab2 $+ \1 $+ %ab2 $+ , $+ %ab1 $+ \2
  .echo -q $regsub($1,/(.)(.?)/g,%x,%x) 
  return %x 
} 
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) && (!$inpaste) { 
    say $$ctalker($1-) 
    halt 
  } 
} 
#acb end
#withbb off
;Bold color w/ background
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) { 
    var %x =  $+ %bg1  
    var %z = %bg2    
    say %x $+ , $+ %z $+ $1- 
    halt 
  } 
}
#withbb end
#randomb off
;Bold random color
on *:input:*: { 
  var %r = $r(1,15)  
  if (/* !iswm $1) && (!$ctrlenter) && ($len(%r) < 2) { 
    var %c = $+(0,,,%r)    
    say  $+ %c $+ $1- 
    halt  
  }
  elseif (/* !iswm $1) && (!$ctrlenter) {
    say  $+ %r $+ $1-
    halt  
  } 
}
#randomb end
#bs off
;Bold single color
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) { 
    say $+(,%sc,$1-,) 
    halt 
  } 
}
#bs end
#altb off
;Bold alternating color
alias ctalker { 
  var %x 
  .echo -q $regsub($1,/(.)(.?)/g, $+ %a1 $+ \1 $+ %a2 $+ \2,%x) 
  return %x 
} 
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) && (!$inpaste) { 
    say $$ctalker($1-) 
    halt 
  } 
} 
#altb end
#backaltb off
;Bold alternating color w/ background
alias ctalker { 
  var %x =  $+ %ab1 $+ , $+ %ab2 $+ \1 $+ %ab2 $+ , $+ %ab1 $+ \2
  .echo -q $regsub($1,/(.)(.?)/g,%x,%x) 
  return %x 
} 
on *:input:*:{ 
  if (/* !iswm $1) && (!$ctrlenter) && (!$inpaste) { 
    say $$ctalker($1-) 
    halt 
  } 
} 
#backaltb end

menu * {
  Turn Color $iif($group(#color) == on,Off,On) { 
    if ($group(#color) == on) { 
      .disable #color #single #cwb #r #acb #ac #bs #withbb #randomb #backaltb #altb | echo -a *Color Script Disabled | unset %sc | unset %bg1 | unset %bg2 | unset %ab1 | unset %ab2 | unset %a1 | unset %a2 | unset %bold 
    }  
    else { .enable #color | csc } 
  }
}