It is currently March 28th, 2024, 4:40 pm

Complementary Colors

Get help with creating, editing & fixing problems with skins
mattitta
Posts: 14
Joined: January 26th, 2019, 3:17 am

Complementary Colors

Post by mattitta »

Hello Everyone new to Rainmeter trying to make my own skin. I've started by making a color selector using rainRGB for font colors and image colors.
What I would like to do is that when I pick a font color is to have a complementary color for the image, right now I would have to go online to find that color. Is this even possible or not any help would be appreciated. Also I'm an older fellow so my isn't as sharp as it was once, but working on this has helped make it sharper.

4.2.0 r3111 64-bit (Jul 8 2018) - English (1033)
Windows 10 Pro 1809 64-bit (build 17763) - English (4105)
Path: C:\Program Files\Rainmeter\
SkinPath: C:\Users\matti\Documents\Rainmeter\Skins\
SettingsPath: C:\Users\matti\AppData\Roaming\Rainmeter\
IniFile: C:\Users\matti\AppData\Roaming\Rainmeter\Rainmeter.ini
Attachments
Settings.ini
(10.05 KiB) Downloaded 15 times
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Complementary Colors

Post by balala »

mattitta wrote: January 26th, 2019, 3:46 am I've started by making a color selector using rainRGB for font colors and image colors.
What I would like to do is that when I pick a font color is to have a complementary color for the image, right now I would have to go online to find that color. Is this even possible or not any help would be appreciated.
You can find a good description of complementary colors here: https://forum.rainmeter.net/viewtopic.php?f=119&t=26837&p=140161&hilit=complementary+colors#p140153
and here: https://forum.rainmeter.net/viewtopic.php?f=119&t=26837&p=140161&hilit=complementary+colors#p140161
Based on the above descriptions, I added a few measures to your code, to make the needed calculations. Here they are: add the following measures to your code:

Code: Select all

[MeasureRed]
Measure=String
String=#ImageTint#
RegExpSubstitute=1
Substitute="^(\d{1,3}),(\d{1,3}),(\d{1,3})$":"\1"
DynamicVariables=1

[MeasureGreen]
Measure=String
String=#ImageTint#
RegExpSubstitute=1
Substitute="^(\d{1,3}),(\d{1,3}),(\d{1,3})$":"\2"
DynamicVariables=1

[MeasureBlue]
Measure=String
String=#ImageTint#
RegExpSubstitute=1
Substitute="^(\d{1,3}),(\d{1,3}),(\d{1,3})$":"\3"
DynamicVariables=1

[MeasureComplementaryRed]
Measure=Calc
Formula=(( Max ( [MeasureRed], Max ( [MeasureGreen], [MeasureBlue] ))) + ( Min ( [MeasureRed], Min ( [MeasureGreen], [MeasureBlue] ))) - [MeasureRed] )
DynamicVariables=1

[MeasureComplementaryGreen]
Measure=Calc
Formula=(( Max ( [MeasureRed], Max ( [MeasureGreen], [MeasureBlue] ))) + ( Min ( [MeasureRed], Min ( [MeasureGreen], [MeasureBlue] ))) - [MeasureGreen] )
DynamicVariables=1

[MeasureComplementaryBlue]
Measure=Calc
Formula=(( Max ( [MeasureRed], Max ( [MeasureGreen], [MeasureBlue] ))) + ( Min ( [MeasureRed], Min ( [MeasureGreen], [MeasureBlue] ))) - [MeasureBlue] )
DynamicVariables=1

[MeasureComplementaryColor]
Measure=String
String=[MeasureComplementaryRed],[MeasureComplementaryGreen],[MeasureComplementaryBlue]
DynamicVariables=1
The DynamicVariables=1 option isn't absolutely needed, but I added it to each measure (see below why).
[MeasureRed], [MeasureGreen] and [MeasureBlue] are returning the color components of the original color, [MeasureComplementaryRed], [MeasureComplementaryGreen] and [MeasureComplementaryBlue] are calculating the components of the complementary color and finally, as probably you figured it out, [MeasureComplementaryColor] is returning the complementary color of the original #ImageTint#.
If you need, a set of similar measures has to be added, to get the complementary color of #FontColor#.

Now a few words about why have I added the DynamicVariables=1 option to all above measures. Usually refreshing the skin is an operation which should have to be avoided: https://forum.rainmeter.net/viewtopic.php?f=5&t=22739&p=120238&hilit=refresh+balala#p120238
So, instead of just writing the variables with !WriteKeyValue bangs, I'd add some !SetVariable bangs to the LeftMouseUpAction options of [MeterColor1] - [MeterColor20], respectively [MeterColor1a] - [MeterColor20a] meters and would remove the !Refresh bangs. For example the updated [MeterColor1] meter would be:

Code: Select all

[MeterColor1]
Meter=IMAGE
ImageName=#@#ColorSet.png
X=30
Y=80
W=20
LeftMouseUpAction=[!WriteKeyValue Variables FontColor "255,255,255" "#@#Variables.inc"][!SetVariable FontColor "255,255,255"][!UpdateMeter "MeterShape"][!UpdateMeter "MeterLine2"][!UpdateMeter "MeterSettingsText"][!UpdateMeter "MeterFontColor"][!UpdateMeter "MeterChangeImageColor"][!Redraw]
ImageTint=255,255,255
ToolTipText="White"
Along with this, you also have to add a DynamicVariables=1 option to all meters and measures which are using this variable ([MeterShape], [MeterLine2], [MeterSettingsText], [MeterFontColor] and [MeterChangeImageColor] and the above measures, where I already added it).

And one more: !Execute is a deprecated bang. Don't use it.

Please let me know if you succeeded implementing all this.
mattitta
Posts: 14
Joined: January 26th, 2019, 3:17 am

Re: Complementary Colors

Post by mattitta »

Thank you balala for all your help. I've made a rmskin so you could review it and if you have any other insight. With that being said it doesn't seem to work, for example if I click on the red button under image colors heading the bar on the volume will turn red but the text will not turn cyan which is the complementary color of red. Once again thank you i've learned alot so far and would like to learn more.
Attachments
Test Skin_4.2 r3111.rmskin
(676.7 KiB) Downloaded 17 times
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Complementary Colors

Post by balala »

mattitta wrote: January 27th, 2019, 8:13 am Thank you balala for all your help. I've made a rmskin so you could review it and if you have any other insight. With that being said it doesn't seem to work, for example if I click on the red button under image colors heading the bar on the volume will turn red but the text will not turn cyan which is the complementary color of red. Once again thank you i've learned alot so far and would like to learn more.
The complementary color of #ImageTint# is calculated and returned by the [MeasureComplementaryColor] measure, but not used nowhere in the code. To use it replace the FontColor option of the [MeterImageText] meter with FontColor=[MeasureComplementaryColor].
mattitta
Posts: 14
Joined: January 26th, 2019, 3:17 am

Re: Complementary Colors

Post by mattitta »

Thank you for the input but that didn't work for me what i'm trying to do is have it change the variable fontcolor in the variables.inc file so it affects all the skins,
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Complementary Colors

Post by eclectic-tech »

mattitta wrote: January 27th, 2019, 6:23 pm Thank you for the input but that didn't work for me what i'm trying to do is have it change the variable fontcolor in the variables.inc file so it affects all the skins,
Late reply :D You could look at Color Triad for some ideas. :sly:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Complementary Colors

Post by balala »

mattitta wrote: January 27th, 2019, 6:23 pm Thank you for the input but that didn't work for me what i'm trying to do is have it change the variable fontcolor in the variables.inc file so it affects all the skins,
But clicking on a color in any section of the skin (Font Colors or Image Colors), makes that change in Variables.inc. You can simply check this: Write down what color codes are stored in that file, click a color on one or both sections of the skin, open the Variables.inc again and see what color codes are stored this time. They / it changed, according to the color you've clicked previously.
Am I right?
mattitta
Posts: 14
Joined: January 26th, 2019, 3:17 am

Re: Complementary Colors

Post by mattitta »

Thank you eclectic-tech and balala for your help, first eclectic-tech if I use color triad will it change the fontcolor and imagetint variables automatically in the variables.inc file,second balala clicking on any color will make the change in the variables.inc file but not give me the complementary color. If the font color is 255,255,255 and then I click on the red color for image color in the variables.inc file the image tint shows 255,0,0 but fontcolor does not change to 0,255,255 as that is the complementary color of red.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Complementary Colors

Post by balala »

mattitta wrote: January 28th, 2019, 7:21 pm second balala clicking on any color will make the change in the variables.inc file but not give me the complementary color. If the font color is 255,255,255 and then I click on the red color for image color in the variables.inc file the image tint shows 255,0,0 but fontcolor does not change to 0,255,255 as that is the complementary color of red.
Oh, let's wait a second. I think I've misunderstood you. So, when you click a image color, you want the font color to become the complementary color of image color? Is this right? And the setting should work vice-versa too? I mean if you click a font color, the image color should become the complementary color of the chosen font color as well? Is this right as well?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Complementary Colors

Post by eclectic-tech »

mattitta wrote: January 28th, 2019, 7:21 pm Thank you eclectic-tech and balala for your help, first eclectic-tech if I use color triad will it change the fontcolor and imagetint variables automatically in the variables.inc file...
The skin is set up to copy any of the color value shown in the top 3 buttons to the clipboard. It could be changed to write the values to a variable in a skin, or included file, then refresh the skin. So yes it can be done...

The middle-click action to pick a color from your desktop is working, but there is something "borked" with the color picker plugin; it is not working in my skin and another one by the writer of the plugin, when you pick a color from the color spectrum.

I will have to inquire about that issue. :???:
Post Reply