It is currently March 19th, 2024, 4:08 am

ColorPicker

Skins that control functions in Windows or Rainmeter
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

Made the "actions" to take when you "save" the color more flexible, by just having it be one action line that you can define with as many bangs or commands as you like / need.

Code: Select all

[Variables]
; Set this as desired. Just remember that the current color is obtained in the variable [#Chosen]
ActionsToTake=[!WriteKeyValue Variables MyColor "[#Chosen]" "#@#ColorInclude.inc"][!Refresh "*"]
New .rmskin in first post of thread.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

Ok, I have done some major rework on the skin. The goal of this work is to make using this color picker in your own skins and suites of skins far easier, and to allow it to be added to your own .rmskins for distribution.

So what I have done is to eliminate any reliance on @Resources or any relative position to any root config folder in this skin. That means you can just drop the entire ColorPicker folder into your existing config folders, and it will work as expected.

Note, I had to cheat a bit and use the deprecated LocalFont functionality to include the FontAwesome font without forcing you to move it to your @Resources\Fonts folder. It's fine just where it is.

So to use this now, 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:

Code: Select all

[Variables]
; Set this 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 colors
; [&Lua:formHue] [&Lua:formSat] [&Lua:formBri] - the separate hue, saturation, brightness HSB colors
; [&Lua:curHex] - the HEX value of the RGB color in the form ffffff
ActionsToTake=[!WriteKeyValue Variables MyColor "[#Chosen]" "#@#ColorInc.inc"][!Refresh "#ROOTCONFIG#"]
That should be all you need to do. 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.

The .rmskin can be found in the first post of this thread.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

Ok, another major update to ColorPicker

I have changed the CursorColor plugin, and added support for a new RealTime=0/1 on the measure in the skin. If RealTime is equal to 1, then the plugin will constantly retrieve the color under the cursor, and return the value to the measure. If RealTime is equal to 0, the default, then you must update it with !CommandMeasure as before.

With this change to the plugin, I have altered the ColorPicker skin to display the color under the cursor at all times when the "eyedropper" icon has been selected. This can help you to zero in on a particular color on the screen, since you can see the result instantly in the skin. Then just click when you have the one you want.

The new CursorColor plugin will be installed, and both 32bit and 64bit versions are included in the "Extras" folder in the skin for use in your own creations.

The latest versions of the ColorPicker (stand alone) and TestColor (demonstrates using it in your own skins) .rmskins can be downloaded in:

The first post of this thread
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

Just some minor tweaks to performance and cosmetics in the various skin and .lua code.

Update in the first post of this thread.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

Added the ability to get the "Luminance" of the selected color. This is the "perceived lightness" of the color, and is a different animal than the "brightness" component of the HSB color model. It is a value from 0-100%, with 0 being "dark" and 100 being "light". This can be used to make a judgment call when for instance putting a text of some color on a solid background. This will allow you to determine if the text is going to look better on a "lighter" or "darker" background color.

The function has been added to the HSBLib.lua library in the first post of this thread. It is included in both the ColorPicker.rmskin that is the stand-alone version of the skin, and the TestColor.rmskin that demonstrates how you might use it in your skin folders. TestColor.ini shows how you might use the Luminance value in your skin.

Code: Select all

[MeasureLumens]
Measure=Calc
Formula=#MyLumens#
IfCondition=MeasureLumens <= 60
IfTrueAction=[!SetOption MeterHello SolidColor "232,232,232,255"]
IfFalseAction=[!SetOption MeterHello SolidColor "47,47,47,255"]
UpdateDivider=-1
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

Broke the mouse over effect on the icons in the last update...

Also the Tooltips are now disabled by default, as they quickly get annoying. Enable them if you like by commenting out the line

ToolTipHidden=1

in the [Rainmeter] section of the skin.

New .rmskin in first post of thread.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5364
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: ColorPicker

Post by eclectic-tech »

Good call on those pesky tooltips ;-)

I especially like the "color under cursor" feature! It is a thousand times better at seeing the current color versus the "old" magnification technique. :thumbup:

Thanks for sharing! :great:
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

eclectic-tech wrote:Good call on those pesky tooltips ;-)

I especially like the "color under cursor" feature! It is a thousand times better at seeing the current color versus the "old" magnification technique. :thumbup:

Thanks for sharing! :great:
Magnification has some charm, but hard to implement in this environment.

I can have the plugin get an area around the cursor, say 50px by 50px, and zoom in on it by some factor, but the issue is what to do with that. It would by its nature create a bitmap image in memory in the C++, but then what? None of the options are pretty.

I can just display it as a floating area around the cursor itself, but I have found that that can hurt as much as help in finding the spot you want, it's not that easy to have a "window" follow the cursor around in real time, and there are real-estate issues if you are at the edge of the screen.

I can put the magnified area somewhere else on the screen, but that has complexities with moving it out of the way if the spot you want is under it, and it's a bit awkward to have to look back and forth between the cursor and the magnified area somewhere else on the screen.

The best option is to have the magnified area in the skin itself, but that isn't easily possible. It would mean just hammering the hard drive to save an image file every few milliseconds, and having a skin Update that is very low, to I can display it in an Image meter in the skin. Not thrilled with that idea.

What I'd really like is a change to the Image meter in Rainmeter that could could use an inline Plugin section variable to get the contents of the "bitmap" from the memory of the plugin, and treat that as an "ImageName" for purposes of the meter. That's a pretty hefty bit of coding change for the Image meter, and has a very limited audience.

So unless I have some epiphany, I think we live without magnification for the time being. Being able to see the color that is under the cursor at all times does help.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5364
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: ColorPicker

Post by eclectic-tech »

What I attempted to convey ... :???:

You added the real time current color option to your color picker action a few updates ago.

I was simply saying thanks, because "I preferred that over any type of magnification".

Anyways, thanks again! :lol:
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorPicker

Post by jsmorley »

Ok, major change to the CursorColor plugin and the ColorPicker skin.

I have added the ability (optional) to display a "zoomed" area around the cursor in the skin when you are actively picking a color from anywhere on the screen.
1.jpg
Readme.txt:

Code: Select all

CursorColor Plugin
Retrieves the color of the pixel under the cursor, and optionally creates a zoomed bitmap of the area around the cursor.

The only required plugin option is:
 
 Format
 
 which can be RGB/Red/Green/Blue.

[MeasureRGBColor]
Measure=Plugin
Plugin=CursorColor
RealTime=0
Format=RGB

[MeasureRedColor]
Measure=Plugin
Plugin=CursorColor
RealTime=0
Format=Red

[MeasureGreenColor]
Measure=Plugin
Plugin=CursorColor
RealTime=0
Format=Green

[MeasureBlueColor]
Measure=Plugin
Plugin=CursorColor
RealTime=0
Format=Blue


Other plugin options:

To retrieve the color constantly, set Update=100 or some similar low value in your skin, and use the option

RealTime=1

On the measure.

To retrieve the color only on a mouse click, set any desired Update in the skin, and use the option 

RealTime=0 (or leave this option off altogether)

and retrieve the color with

[!CommandMeasure MeasureName "GetColor"].

On a mouse click action.

 
If RealTime=1 then other options are valid:

ZoomCreate			0 or 1 to turn off / on returning a zoomed bitmap image of the area around the cursor
ZoomToWidth		Number of pixels width for the image to return
ZoomToHeight		Number of pixels height for the image to return
ZoomFactor			Number of times to "zoom" the area around the cursor
 
 The plugin will return "ZoomBitmap.bmp" in the current skin folder on each measure update.
 
New .rmskin in first post of thread.

You can disable it with a variable in the skin eclectic-tech... ;-)
Post Reply