It is currently November 26th, 2022, 8:19 pm

ColorSetter for Rainmeter

Skins that control functions in Windows or Rainmeter
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

ColorSetter for Rainmeter

Post by Edhel »

So, in short, I wanted to have a possibility to change a color of text and background in a suite I was creating and I was looking for ways how to do it... Of course, there is jsmorley's amazing RainRGB but I didn't want to use an "external" program so I created this ColorSetter. As you can see, it is very much inspired by jsmorley's program and it is more a utility for skin creators than for usual users but it can be easily implemented in any suite or skin. So, what can it do?
It will allow you to change any color defined in variables.inc or create new one.
You can chose to set RGBA color with an alpha channel to set some transparency to the color, or only RGB color - this can be usefull if you have a rainmeter suite in one tone and with several defined colors with different transparencies; you can change only the main color and all other will change
(if you have for example variables
BlueColor=20,20,220 ; as the main color
BlueBackground=#BlueColor#,50 ; for soft backgrounds
BlueAnother=#BlueColor#,150 ; for bars and roundlines...
)
It will remember the last edited color and will allow you to reverse the changes if you aren't satisfied (however, it will not allow you to "destroy" a new colour you have created).

THERE IS A BETA VERSION TOO? What is the difference?
Exper1mental had some nice and productive suggestions so I wanted to implement them in the skin. The Beta (in the meaning of "second")...
- has come with simply adjustable size. (Included in the original version now too.)
- allows you also to enter the numeric value of desired color.
- has a little RGB(A) HEX converter so you can also see a HEX value of your color or enter the value to the box to get the color. However, the final color is always saved in RGB(A) format.
- requires latest 3.1 Beta version of Rainmeter as it uses IfCondition functions.

How to work with it?
You will need a variables.inc file where you store your clors and other stuff (if you don't understand using the external .inc files, you should reconsider using this). So, when you have that external variables.inc, open ColorSetter (and ColorSetter-Aplha) for editing and put a path for your file to the first @Include in [Variables] section (idealy something like @Include=#SKINSPATH#MySuiteFolder\#@#variables.inc). Then you just need to load the skin (RGB or RGBA, whichever you need), remember the name of your variable and put it in the "Change me" box (press ENTER!). If you are "editing" some color you already have created, the actual color should appear in the left part of the little box next to the "Chosen color:" label. Play with the tint, shade and alpha and click the "Apply new color" when you are done.
If you want to implement it in your own skin, and let the user to change the color, copy the code, adjust the positions etc... Obviously, you will not want the user to write there a name of some variable, so throw away the [InputColor] measure and [ChangedVariable] meter, you will not need those. However, you will still need to set the variable, so you cand create some new string meters for example and do something like this:

Code: Select all

[LabelForText]
Meter=String
Text=Change the color of text
LeftMouseUpAction=[!WriteKeyValue Variables changedcolorvariable "NAMEOFYOURVARIABLE" "#@#variables-color.inc"][!WriteKeyValue Variables defaultcolor "#NAMEOFYOURVARIABLE#" "#@#variables-color.inc"][!Refresh]
[LabelForBackground]
Meter=String
Text=Change the color of background
LefMouseUpAction...
Note that in the first bang there is a name of the variable - without the "#" - and in the second bang, there is the #variable# with "#". This is important for this skin to work. ... Of course, I have skipped some unimportant stuff in the example... Obviously, if you implement the ColorSetter in your own skin, you will not need to adjust the path for the variables.inc (I suppose you already have it there and you store them in the Resources folder) but you will need to put variables-color.inc in the Resources folder and and put the @Include2=#@#variables-color.inc line at the end of the [Variables] section. (Note: the variables-color.inc serves to store the variables like position of the pointer and temporary values during the process of the setting color, please don't change it unless you know what are you doing.)
If you find the ColorSetter too big (it isn't small), open the ini file (ColorSetter.ini or ColorSetter-Alpha.ini), in the [Variables] section delete the semicolon on the begining of the line with ;colorsettersize=255 and write there a new value. (Or go to the variables-color.inc in the Resources folder and edit the same line.)

Requirements:
It was created with 3.1. beta Rainmeter but I believe that 3.0.2 version (latest stable releas) should be able to work with it. The Beta version requires the 3.1. Beta Rainmeter as I already said.
Doesn't need any special plugin... I don't understand them... or LUA scripting, so it is pure Rainmeter code:)

Credits
As I already said, it was inspired by jsmorley's RainRGB addon for Rainmeter and exper1mental suggested a new features for Beta version.
I hope it will be of some use for you people. Feel free to take it, edit or use in your own suites or skins, however, don't forget to mention me in credits (ideally, put there link to my DeviantArt page http://squirrel-slayer.deviantart.com/). And of course, let me know if there is anything wrong with it (again, preferably throug DeviantArt if you are there - I am there more often than here).
You do not have the required permissions to view the files attached to this post.
Last edited by Edhel on May 25th, 2014, 10:23 am, edited 6 times in total.
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: ColorSetter for Rainmeter

Post by exper1mental »

So far it works like a charm on 3.0.2.

It would be nice if the user could type in RGB values and see what they look like in addition to selecting them. i.e. I know I want a certain shade of yellow so I type in some RGB values and then use the color picker to further refine things.

A half-size (or maybe 75% size) variant color setter would also be nice for skins where having a full 255 spectrum isn't necessary and or is too bulky. i.e. Someone wanted the color setter was built into their skin instead of as a stand-alone skin, having a half size would be very helpful in keeping things from getting too big and screen hogging.

I have no idea how feasible this is but it would be great if the skin could convert HEX values to RGB and also display the HEX value for the selected color (personally I'd never want to save a color in HEX format but being able to have access to and convert HEX values without launching an external program would be VERY handy)

Just some nit-picky thoughts and suggestions ;-)


Anyways, if I decide to use this I'll modify it so that when a button is clicked to load this skin the button sends a bang telling what variable is to be edited. Having the end-user dig through my variables files (which can be pretty big depending on the skin) to change colors (and hope they found the right one even though I try to use descriptive names) just wouldn't work well.
Image
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: ColorSetter for Rainmeter

Post by Edhel »

Hi, exper1mental, thank you for your ideas:)
I am sorry the answer took me so long but I didn't want to write only that it was a great idea and I "would" do that...

So - writing the numeric value - yes, it is quite an essential function, I don't know why didn't I include it in the first version.
Adjustable size is also a good idea (and actually, pretty simple). I created ColorSetter partly as an experiment and width and height of 255 for the shade "window" was logical choice as the color values are from 0 to 255. The smaller version works too, however might be a little less acurate. To change the size, open desired ini file (ColorSetter.ini or ColorSetter-Alpha.ini) and i the variables section delete the semicollon on the begining of the line with ;colorsettersize=255 and set there a new value. The rest will adapt. (Or you can change the size of both of them by editing the same line in the variables-colo.inc in the Resources folder.)
I thought that HEX values would be impossible without LUA scripting. And I was wrong, the equations are actually pretty simple and it was much faster to write this part than the crazy equations for calculating the color from the number:)

The new ColorSetter Beta with your ideas implemented is downlodable under the original post:) However, this Beta version requires 3.1 Beta Rainmeter to run (the functions to calculate the "basic tint" and position of the cross from the entered value use IfCondition options).

You are right about not allowing the users to browse through the names of the variables. I wouldn't let them do that either. Therefore there is the exemplary string meter with the requried bangs for setting the edited color in the original description.
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: ColorSetter for Rainmeter

Post by exper1mental »

Nice, I'll definitely check out the beta version, whenever I finally decide to upgrade to 3.1. :p

I did noticed a small bug when messing with the variable colorsettersize, the palette pointer, hue arrow, and saturation/alpha arrow do not adjust to the resizing of the skin correctly when it is refreshed.

The X values of both arrows are correct but the Y values do not adjust.

Neither the X or Y values of the palette pointer adjust.

This is using 1.01.


Side Note: Small nitpicky suggestion, add a small border or something around the arrows so they still be easily seen when the color is near-black or near-transparent.
Image
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: ColorSetter for Rainmeter

Post by Edhel »

I think we all are eagerly expecting the day when 3.1 stops to be "beta" and officially becames "stable":) (so we can put our horses there)

Actually, that is not really a bug in the skin (or so I excuse). This happens only if you first play with the sliders and then change the size. If you do this, the (variable) positions of the cross and pointers are saved as for example 75% of the 255-size and if you change the size then, the skin still load the "75% of 255" but the bars and window have the new size. If you (or anybody else) implement ColorSetter in your own skin, I suppose you will define the size and will not let the user to change it so the user will get the proper positions. I suppose it could be fixed by some bang in the OnRefreshAction that would set new positions according to the new scale but it would also set the position on every refresh even if the scale would be the same. It seems to me like unnecessary.

As to side note: I was thinking about some border around the pointer but it wouldn't work as the color of the pointer is defined by ImageTint and it would change the border too... However, your nitpicky suggestion pushed me again:) There is a smaller always-white pointer inside the original pointer now:) (Another relatively positioned picture - how could it be so simple?:)
User avatar
jsmorley
Developer
Posts: 22551
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorSetter for Rainmeter

Post by jsmorley »

I think we all are eagerly expecting the day when 3.1 stops to be "beta" and officially becames "stable":) (so we can put our horses there)
Ask and ye shall receive...
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: ColorSetter for Rainmeter

Post by exper1mental »

Edhel wrote:As to side note: I was thinking about some border around the pointer but it wouldn't work as the color of the pointer is defined by ImageTint and it would change the border too... However, your nitpicky suggestion pushed me again:) There is a smaller always-white pointer inside the original pointer now:) (Another relatively positioned picture - how could it be so simple?:)
Thanks for the quick response and update! :D Both 1.01 and 1.2 are running smoothly on Rainmeter 3.1 (so excited to try out the new features!).
Image
User avatar
jsmorley
Developer
Posts: 22551
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ColorSetter for Rainmeter

Post by jsmorley »

exper1mental wrote:...Rainmeter 3.1 (so excited to try out the new features!).
I think you will like IfConditions in particular. It is so much better than trying to stuff 10 pounds of functionality into the 5 pound sack that is IfActions.
User avatar
Edhel
Posts: 36
Joined: February 18th, 2014, 4:41 pm

Re: ColorSetter for Rainmeter

Post by Edhel »

jsmorley wrote: Ask and ye shall receive...
Amazing! Dear Buddha, please bring me a pony and plastic rocket...:)
exper1mental wrote:Thanks for the quick response and update!...
Well, I was just going to upload it to deviantArt when I read your message so I just made a little editing and put it here too:)
User avatar
TweaknFreak
Posts: 217
Joined: July 14th, 2012, 7:26 am

Re: ColorSetter for Rainmeter

Post by TweaknFreak »

Can I use it on my skin ?

I'm also thinking of implementing a list of the variables to which color changes matter placed beside your configurator and when the user selects a variable by clicking the variable gets copied automatically to the Change me input box.
Be one of the iNEViTABLES - Storm, Earthquake, Lightning, Flood - and the world will bow down to you.

My current desktop
[hsimg]http://i1313.photobucket.com/albums/t559/TweaknFreak/6-22-20149-46-40PM_zps7bcbc1f6.png[/hsimg]