ColorPicker W/Color Dialogs

By FordLawnmower on Apr 23, 2009

This script serves a very basic function that is already included in mirc's color dialogs. The basic function of this script is to change your background and foreground(normal text) colors.
The reason I am posting this is to demonstrate how to create a color pallet with mirc's drawfill/drawsave functions, and then use it to spice up your dialogs with a little COLOR :)
The jewel of this script is the MakeColorIcons alias. This alias creates a small bitmap image for each of the 16 colors available in mirc.
If you look at this line - ->

window  -hBpf +d @MakeColorIcons -1 -1 68 68

The last two numbers determine the size of the bmp. 68 x 68 is equal to 34 x 34 in dialogs.
You can change these two numbers, in conjunction with the last two numbers in the drawfill line, to change the file size/shape.
In addition, you can also use $rgb() in the drawfill line, to create custom colors.
Basically, anything you can draw in a window, can be saved with drawsave and used in dialogs or elsewhere in mirc.
From here you just need to add a icon spot in your dialog and add your color with did -g dialogname N pathtofile\filename.bmp
Image
:)

alias MakeColorIcons {
  var %c 0
  if (!$isdir($+($mircdir,ColorIcon))) { mkdir ColorIcon }
  while (%c <= 15) {
    if (!$window(@MakeColorIcons)) { window  -hBpf +d @MakeColorIcons -1 -1 68 68 }
    drawfill @MakeColorIcons %c %c 0 0 68 68
    if (!$isfile($+(ColorIcon\,ColorIcon,%c,.bmp))) { drawsave @MakeColorIcons $qt($+($mircdir,ColorIcon\,ColorIcon,%c,.bmp)) }
    inc %c
  }
  window -c @MakeColorIcons
}
alias ColorPicker {
  if (!$dialog(ColorPicker)) { dialog -m ColorPicker ColorPicker }
  else { dialog -v ColorPicker ColorPicker }
}
dialog ColorPicker {
  title "Color Picker"
  size -1 -1 90 88
  option dbu
  icon 1, 2 2 8 8
  icon 2, 13 2 8 8
  icon 3, 24 2 8 8
  icon 4, 35 2 8 8
  icon 5, 46 2 8 8
  icon 6, 57 2 8 8
  icon 7, 68 2 8 8
  icon 8, 79 2 8 8
  icon 9, 2 15 8 8
  icon 10, 13 15 8 8
  icon 11, 24 15 8 8
  icon 12, 35 15 8 8
  icon 13, 46 15 8 8
  icon 14, 57 15 8 8
  icon 15, 68 15 8 8
  icon 16, 79 15 8 8
  button "", 17, 4 4 4 4
  button "", 18, 15 4 4 4
  button "", 19, 26 4 4 4
  button "", 20, 37 4 4 4
  button "", 21, 48 4 4 4
  button "", 22, 59 4 4 4
  button "", 23, 70 4 4 4
  button "", 24, 81 4 4 4
  button "", 25, 4 17 4 4
  button "", 26, 15 17 4 4
  button "", 27, 26 17 4 4
  button "", 28, 37 17 4 4
  button "", 29, 48 17 4 4
  button "", 30, 59 17 4 4
  button "", 31, 70 17 4 4
  button "", 32, 81 17 4 4
  icon 33, 6 36 34 34
  icon 34, 50 36 34 34
  radio "Foreground", 35, 6 24 37 10
  radio "Background", 36, 48 24 37 10
  button "Close", 37, 56 74 29 12, cancel
  button "Accept", 38, 5 74 29 12
}
On *:Dialog:ColorPicker:Close:*: {
  unset %ColorPicker*
}
On *:Dialog:ColorPicker:Sclick:*: {
  if ($did >= 17) && ($did <= 32) {
    if ($did(ColorPicker,35).state == 1) { 
      did -g ColorPicker 33 $+(ColorIcon\,ColorIcon,$calc($did - 17),.bmp)
      set %ColorPickerFG $calc($did - 17)
    }
    if ($did(ColorPicker,36).state == 1) { 
      did -g ColorPicker 34 $+(ColorIcon\,ColorIcon,$calc($did - 17),.bmp)
      set %ColorPickerBG $calc($did - 17)
    }
  }
  if ($did == 38) {
    color normal text %ColorPickerFG
    color background %ColorPickerBG
  }
}
On *:Dialog:ColorPicker:init:*: {
  MakeColorIcons
  var %c = 0
  while %c <= 15 {
    did -g ColorPicker $calc(%c + 1) $+(ColorIcon\,ColorIcon,%c,.bmp)
    inc %c
  }
  did -c ColorPicker 35
  set %ColorPickerFG $color(normal text)
  set %ColorPickerBG $color(background)
  did -g ColorPicker 33 $+(ColorIcon\ColorIcon,$color(normal text),.bmp)
  did -g ColorPicker 34 $+(ColorIcon\ColorIcon,$color(background),.bmp)
}
menu * {
 ColorPicker:ColorPicker
}

Comments

Sign in to comment.
TheProdigY   -  Jun 17, 2009

FordLawnmower, I've got one more question, hopefully. When I loaded your script up, I changed it from white text, and blue background. It shows up just as plain text black letters, white background. I unloaded the colors.mrc that came with my Beirut v4 mIRC v6.35. All it does is change the channel background colors to whatever color I chose and the text color to whatever I chose. I just wanted my channel (chatroom, PM, whatever) as black background and my text ONLY to be blue background with white text. I don't know what's going on with that. Any solutions?

 Respond  
FordLawnmower   -  Jun 17, 2009

You're welcome TheProdigY :)

 Respond  
TheProdigY   -  Jun 17, 2009

Nevermind! I figured it out! Thank you so much FordLawnmower. And thanks for this excellent color script!

 Respond  
TheProdigY   -  Jun 17, 2009

Ok, I did that. I put it in the Remote. Saved it as a unique name, clicked ok. Nothing happened. Do I need to do something else for it to come up?

 Respond  
FordLawnmower   -  Jun 17, 2009

You have to put this into remotes TheProdigY.
Alt+r -- From the file menu select NEW. --- Then paste the code and save it with a unique file name.

 Respond  
TheProdigY   -  Jun 17, 2009

Hey, I'm going to ask this question here and in the forums. When I pasted this code in the Aliases of my mIRC v6.35 Script Editor I get this...

-G Unknown command

-G Unknown command

-17 Unknown command

-G Unknown command

-G Unknown command

-G Unknown command

-G Unknown command

 Respond  
FordLawnmower   -  May 07, 2009

Thank you eyiezinc :)

 Respond  
eyiezinc   -  May 06, 2009

amazing..good job FordLawnmower

 Respond  
FordLawnmower   -  Apr 25, 2009

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 Respond  
FordLawnmower   -  Apr 25, 2009

Thanks Aucun50 :)

 Respond  
Aucun50   -  Apr 24, 2009

I like how you did this very neat.

 Respond  
FordLawnmower   -  Apr 24, 2009

Thanks err0r007 :)

 Respond  
err0r007   -  Apr 24, 2009

nice job... good example

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.