It is currently March 29th, 2024, 1:26 am

GetAvgColor

Share and get help with Plugins and Addons
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

GetAvgColor

Post by jsmorley »

Ok, here is a marginally useful but fun addon for Rainmeter.

What this does is find the "average color" of your desktop, by sampling the entire screen and averaging the colors of all the pixels. You call it with "GetAvgColor.exe Varname" and it will set any Rainmeter variable you pass it with the resulting color code in Red,Green,Blue format.

Now now you can have a skin that automatically changes colors when you change your wallpaper! ;-)

You will need to be running Rainmeter 1.2 RC1 (r430) or better from http://Rainmeter.net to install this .rmskin. Just run the .rmskin from here or download it and double click it to install and run the skin. The actual addon will be installed in your Addons folder in Rainmeter.
GetAvgColor.rmskin
Here is the inlcuded sample skin code, so you can see how to use the addon:

Code: Select all

;=================================================
; Rainmeter configuration file
; Updated June 3, 2010
;=================================================

;[BEGIN CONFIG FILE]==============================

[Rainmeter]
Author=Jeffrey Morley
Update=1000
DynamicWindowSize=1
OnRefreshAction=!Execute ["#ADDONSPATH#GetAvgColor\GetAvgColor.exe" "MyColor"]

;Metadata added by RainBrowser
;http://rainmeter.net/cms/Rainmeter101-EditingSkins

[Metadata]
Name=GetAvgColor
Config=GetAvgColor
Description=Demonstrates use of the GetAvgColor.exe addon for Rainmeter.  Sets color variables based on the average color of your desktop
Instructions=Change your wallpaper and click on the skin to test
Version=June 3, 2010
Tags=Color | Addons
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Variant=0
Preview=

;End of added Metadata

[Variables]
MyColor=255,255,255

[MeterText]
Meter=String
SolidColor=0,0,0,100
FontFace=Trebuchet MS
FontSize=30
FontColor=#MyColor#,255
AntiAlias=1
Text=#MyColor#
DynamicVariables=1
LeftMouseUpAction=!Execute ["#ADDONSPATH#GetAvgColor\GetAvgColor.exe" "MyColor"]

[MeterHints]
Meter=String
FontFace=Trebuchet MS
FontColor=255,255,255,255
FontSize=10
AntiAlias=1
X=1
Y=56
ClipString=1
W=200
H=50
Text=Change your wallpaper#CRLF#Then click above

;[END CONFIG FILE]================================
Hint: I demonstrate this with a text meter, but there is no reason you can't use it with a SolidColor= background, an image meter using ImageTint=, or any other place where a color in R,G,B,A format is used.
You do not have the required permissions to view the files attached to this post.
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: GetAvgColor

Post by poiru »

Just one request: option to return color in hex :)
P2C
Posts: 45
Joined: November 13th, 2009, 10:22 pm
Location: near Würzburg, Germany

Re: GetAvgColor

Post by P2C »

Cool, gonna use this :thumbsu:

Is there a way to change the color if the variable is in a Variables.txt instead of the actual skin I'm executing the program?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: GetAvgColor

Post by jsmorley »

P2C wrote:Cool, gonna use this :thumbsu:

Is there a way to change the color if the variable is in a Variables.txt instead of the actual skin I'm executing the program?
New version with that capability coming in a few minutes....

Edit: http://rainmeter.net/forum/viewtopic.php?f=18&t=4215&p=28993#p28993
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: GetAvgColor

Post by brijamelsh »

This is really cool and I would like to expand on it.

I am working on some additions to the Enigma Skin (adding Volume control, different weather etc..) And this plugin has inspired me.

The idea is to take the average color of the desktop every n minutes.. and use that color in the UserVariables.ini to change the highlight color (the blue that you see in the Enigma skin).

Why would I want to do this?

Well I have my desktop set to change to a random picture every 10 minutes or so. I was originally going to add a color switcher like the one in the Gnometer skin, but to have it done automatically, and much more precisely, would be perfect. For example, this background doesnt go witht he blue highlights of the skin. But using its average color would work nicely:
pciker02.jpg
I just saw your update with the color picker in the 10x10 square, this would also be nice for choosing a color from a wallpaper that is mostly black but with green elements. Example:
pciker01.jpg
I think this would be a big hit with folks, so let me know if your interested. If you don't follow, Id be happy to elaborate.
You do not have the required permissions to view the files attached to this post.
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: GetAvgColor

Post by brijamelsh »

On a side note, I'm getting a "Error: Invalid file" message when I try to run the rmskin file. I am running Rainmeter 440 x64
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: GetAvgColor

Post by jsmorley »

brijamelsh wrote:On a side note, I'm getting a "Error: Invalid file" message when I try to run the rmskin file. I am running Rainmeter 440 x64
We had a problem with some file corruption on attachments a week or two ago. I'll put together a new .rmskin and get it up here, probably tomorrow.
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: GetAvgColor

Post by brijamelsh »

Would it be possible to post the plugin and ski files in the meantime? I'd like to look at the code and start working on the idea mentioned above.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: GetAvgColor

Post by jsmorley »

I have corrected the .rmskin file in the first post of this thread.
User avatar
brijamelsh
Posts: 47
Joined: July 16th, 2010, 4:24 am

Re: GetAvgColor

Post by brijamelsh »

Thanks, works great.