It is currently July 21st, 2019, 9:37 am

ColorPicker

Post your work-in-progress and completed skins to share and discuss.
User avatar
jsmorley
Developer
Posts: 19301
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

ColorPicker

jsmorley » October 9th, 2017, 4:41 pm

After some fun back and forth with eclectic-tech in the Color Triad thread, I decided to see if I could come up with a decent color picker that might be an alternative to the external RainRGB4.exe.

This absolutely requires Rainmeter 4.1 or later.
ColorPicker_4.3.rmskin
1.jpg
2.jpg
  • You can simply pick a color from the spectrum image at the top, or use the eyedropper icon to pick a color from anywhere on your screen(s).
  • You can then "scrub" any of the RGB (Red, Green, Blue) or HSB (Hue, Saturation, Brightness) values with the mouse wheel to fine tune a color.
  • Click anywhere on the RGB or HSB colors to toggle "normal" and "fast" modes for the mouse wheel scrubbing.
  • You can click the "copy" icon to copy the RGB, HSB, HEX or Luminance values to the Windows clipboard.
  • You can click the "edit" icon to enter or edit a HEX color code.
  • You can click the "save" icon to write the selected color to any file you desire, which will likely be some @Include file for your skin(s), and refresh any or all skins you like to see the result in action.
  • Middle-click anywhere on the skin to "minimize" it to a small meter in the bottom left of your screen.
These actions to take when you click "save" are defined in the [Variables] section of the skin:

ActionsToTake=[!WriteKeyValue Variables MyColor "[#Chosen]" "[#CURRENTPATH]Extra\ColorInclude.inc"][!Refresh "*"]

This skin includes:
  • My CursorColor plugin. the 32bit and 64bit .dll's are also included for your own use.
  • My HSBLib.lua library for Lua, to convert between RGB and HSB/HSV colors.
  • The FontAwesome font for the various icons.
Usage in your skins

So to use this, you just drop the ColorPicker folder into your skin's folder at any level, and call it with some form of:

LeftMouseUpAction=[!ActivateConfig "#CURRENTCONFIG#\ColorPicker" "ColorPicker.ini"]

Then just edit the ActionsToTake variable in ColorPicker.ini as you like. The long and the short of it is that ActionsToTake should write the color value to some .inc include file, and then refresh the skin(s) that are using the color. That can be one skin or a group or whatever you need.

Code: Select all

[Variables]
; Set ActionsToTake as desired. Just remember that the current RGB color is obtained in the variable [#Chosen]
; Also available to use are:
; [&Lua:curRed] [&Lua:curGreen] [&Lua:curBlue] - the separate red, green, blue RGB color values
; [&Lua:formHue] [&Lua:formSat] [&Lua:formBri] - the separate hue, saturation, brightness HSB values
; [&Lua:curHex] - the HEX value of the RGB color in the form ffffff
Action1=[!WriteKeyValue Variables MyForeground "[#Chosen]" "#@#ColorInc.inc"][!Refresh "[#ParentConfig]"]
Action2=[!WriteKeyValue Variables MyBackground "[#Chosen]" "#@#ColorInc.inc"][!Refresh "[#ParentConfig]"]
ActionsToTake=[#Action1]
This .rmskin demonstrates using ColorPicker in your own skin folders:
TestColor_1.6.rmskin
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3414
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: ColorPicker

eclectic-tech » October 9th, 2017, 5:21 pm

Very well done! :thumbup:

I had a similar 'Color Pick' skin ready to go, but you added the scrolling feature to tweak values, which I really like, so I may never release mine :-(

One knit-pick ;-)

The values copied to the clipboard contain #CRLF#, so when you paste into say a single-line InputText box, only the hex value appears; the RGB value is there, but above and invisible in the input box. :confused:

I would replace #CRLF# with a space so both values show on the same line. The end user can see both values and delete the undesirable one.

This is about 1/4 the size of RainRGB4.exe, not something Anti-V's will choke on, and does most everything necessary to pick a color. So again, nice work! :great:
User avatar
jsmorley
Developer
Posts: 19301
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

jsmorley » October 9th, 2017, 5:37 pm

Good point! I have what I think might be better yet...
03.png
New .rmskin in first post of thread.
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3414
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: ColorPicker

eclectic-tech » October 9th, 2017, 5:43 pm

A good addition 8-)
User avatar
jsmorley
Developer
Posts: 19301
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

jsmorley » October 9th, 2017, 6:01 pm

eclectic-tech wrote:A good addition 8-)
Thanks. The only thing really missing is the "magnification" when you are in "picker mode", and I just have no clue how best to achieve that. It would take some kind of plugin, but the only way I can think of would be to have it just hammer output of some portion of the screen around the cursor to an image file, which you would then size and display in the skin. I think it might be possible, but I sorta gulp at writing / overwriting an image file every few milliseconds while you move the mouse. That might be a bridge too far...

I'm also mildly irritated that the "overlay", even though set at 0,0,0,1 does in fact add just the tiniest hair of color to the virtual screen, so the color you pick is just a fraction of a percentage off from reality. I need to chew on that a bit, as again the only option is a plugin, but not sure yet how best to handle mouse detection when you are not actually on the skin.

Edit: Think I solved that last bit...

Code: Select all

LeftMouseUpAction=[!SetOption MeterOverlay SolidColor "0,0,0,0"][!UpdateMeter MeterOverlay][!Redraw][!CommandMeasure MeasurePicker "GetColor"][!UpdateMeasure MeasurePicker][!SetVariable Chosen "[&MeasurePicker]" "ColorPicker"][!UpdateMeasure Lua "ColorPicker"][!UpdateMeter * "ColorPicker"][!Redraw "ColorPicker"][!DeactivateConfig]
The trick is that the mouse has already been detected before you change the transparency of the overlay, so the plugin sees it without the added 1% of opacity...

New .rmskin in first post of thread.
User avatar
FreeRaider
Posts: 783
Joined: November 20th, 2012, 11:58 pm

Re: ColorPicker

FreeRaider » October 9th, 2017, 6:40 pm

Good work :thumbup:
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3414
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: ColorPicker

eclectic-tech » October 9th, 2017, 6:46 pm

jsmorley wrote:Edit: Think I solved that last bit...

Code: Select all

LeftMouseUpAction=[!SetOption MeterOverlay SolidColor "0,0,0,0"][!UpdateMeter MeterOverlay][!Redraw][!CommandMeasure MeasurePicker "GetColor"][!UpdateMeasure MeasurePicker][!SetVariable Chosen "[&MeasurePicker]" "ColorPicker"][!UpdateMeasure Lua "ColorPicker"][!UpdateMeter * "ColorPicker"][!Redraw "ColorPicker"][!DeactivateConfig]
The trick is that the mouse has already been detected before you change the transparency of the overlay, so the plugin sees it without the added 1% of opacity...
That's a neat trick! I'll have to add that to mine :sly:
User avatar
jsmorley
Developer
Posts: 19301
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

jsmorley » October 9th, 2017, 6:46 pm

Found an issue with "stay on screen" with someone with two monitors of the same size. Fixed.

New .rmskin in first post of thread.
User avatar
jsmorley
Developer
Posts: 19301
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

jsmorley » October 9th, 2017, 11:35 pm

Had a typo with OnRefreshAction in the Overlay.ini file... Fixed. Thanks eclectic-tech!

Also had an issue as I was using LeftMouseDownAction in the Overlay skin, and that allowed clicks to be passed through to the thing you were clicking on, so you might get a color selection AND some unexpected action from some object you clicked on. Fixed.

New .rmskin in first post of thread.
User avatar
jsmorley
Developer
Posts: 19301
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

jsmorley » October 10th, 2017, 1:29 am

Added the ability to enter or paste in a HEX color code. This can be in the form #ffffff or just ffffff and any case.
03.png
New .rmskin in first post of thread.
You do not have the required permissions to view the files attached to this post.