It is currently September 8th, 2024, 4:34 am

Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Yincognito »

Taher wrote: June 28th, 2024, 5:51 pmor something where it becomes clear what goes where and how to go step by step
Alright, here are the steps you need to follow to implement the 2nd choice I proposed in my 3rd reply on this thread, based on the code in your OP:

1) under the Scale=1.16 line in the [Variables] section of the skin, add this (adjust these variables as desired):

Code: Select all

ChangeInterval=5
WallpaperCount=9
Wallpaper1=D:\Images\Wallpapers\- Single -\Blue Wallpaper.jpg
Wallpaper2=D:\Images\Wallpapers\- Single -\Cold Desert Proxima Centauri.jpg
Wallpaper3=D:\Images\Wallpapers\- Single -\Fiery Red Planet.jpg
Wallpaper4=D:\Images\Wallpapers\- Single -\Lone Space Tree I.jpg
Wallpaper5=D:\Images\Wallpapers\- Single -\Pureness.jpg
Wallpaper6=D:\Images\Wallpapers\- Single -\Sea Dawn I.jpg
Wallpaper7=D:\Images\Wallpapers\- Single -\Space Sunrise I.jpg
Wallpaper8=D:\Images\Wallpapers\- Single -\Volatile Sky.jpg
Wallpaper9=D:\Images\Wallpapers\- Single -\Water.jpg
2) make sure that in your [ChameleonDesktop] and [ChameleonLuminance] measures, you replace Type=Desktop with an initial:

Code: Select all

Type=File
Path=[#Wallpaper1]
3) in the [ChameleonDesktop] measure, add a Group=Target line, then, in the [ChameleonLuminance] measure, change the Group=Luminance line to Group=Target | Luminance, in order to include the two measures in a group named Target for easier management

4) before the [ChameleonDesktop] measure, to iterate through the wallpapers' indexes and paths and set the latter as wallpaper and Path in the Target group:

Code: Select all

[Wallpaper]
Measure=Calc
Formula=(Wallpaper % #WallpaperCount# + 1)
RegExpSubstitute=1
Substitute="^(.*)$":"[#Wallpaper\1]"
UpdateDivider=#ChangeInterval#
OnUpdateAction=[!SetWallpaper "[&Wallpaper]" Stretch][!SetOptionGroup Target Path "[&Wallpaper]"][!UpdateMeasure ChameleonDesktop]
DynamicVariables=1
5) save the file and refresh the skin to see the result

Like already mentioned, this 2nd choice above doesn't even need Wallpaper Engine to work, being suited for your beginner level. For the 1st choice I proposed, you'll have to wait and see if someone else who's using Wallpaper Engine is willing to provide you with another "demo code" that does everything for you with minimal effort from your part. ;-)

For the record, the above code is also suited for the 1st choice described in my 3rd reply from this thread, as long as the [Wallpaper] measure at step 4) is "converted" to a RunCommand measure that gets the path to the image file used by Wallpaper Engine as the current wallpaper, via its command line controls.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Taher
Posts: 10
Joined: June 27th, 2024, 7:10 am

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Taher »

Yincognito wrote: June 28th, 2024, 8:59 pm Alright, here are the steps you need to follow to implement the 2nd choice I proposed in my 3rd reply on this thread, based on the code in your OP:

1) under the Scale=1.16 line in the [Variables] section of the skin, add this (adjust these variables as desired):

Code: Select all

ChangeInterval=5
WallpaperCount=9
Wallpaper1=D:\Images\Wallpapers\- Single -\Blue Wallpaper.jpg
Wallpaper2=D:\Images\Wallpapers\- Single -\Cold Desert Proxima Centauri.jpg
Wallpaper3=D:\Images\Wallpapers\- Single -\Fiery Red Planet.jpg
Wallpaper4=D:\Images\Wallpapers\- Single -\Lone Space Tree I.jpg
Wallpaper5=D:\Images\Wallpapers\- Single -\Pureness.jpg
Wallpaper6=D:\Images\Wallpapers\- Single -\Sea Dawn I.jpg
Wallpaper7=D:\Images\Wallpapers\- Single -\Space Sunrise I.jpg
Wallpaper8=D:\Images\Wallpapers\- Single -\Volatile Sky.jpg
Wallpaper9=D:\Images\Wallpapers\- Single -\Water.jpg
2) make sure that in your [ChameleonDesktop] and [ChameleonLuminance] measures, you replace Type=Desktop with an initial:

Code: Select all

Type=File
Path=[#Wallpaper1]
3) in the [ChameleonDesktop] measure, add a Group=Target line, then, in the [ChameleonLuminance] measure, change the Group=Luminance line to Group=Target | Luminance, in order to include the two measures in a group named Target for easier management

4) before the [ChameleonDesktop] measure, to iterate through the wallpapers' indexes and paths and set the latter as wallpaper and Path in the Target group:

Code: Select all

[Wallpaper]
Measure=Calc
Formula=(Wallpaper % #WallpaperCount# + 1)
RegExpSubstitute=1
Substitute="^(.*)$":"[#Wallpaper\1]"
UpdateDivider=#ChangeInterval#
OnUpdateAction=[!SetWallpaper "[&Wallpaper]" Stretch][!SetOptionGroup Target Path "[&Wallpaper]"][!UpdateMeasure ChameleonDesktop]
DynamicVariables=1
5) save the file and refresh the skin to see the result

Like already mentioned, this 2nd choice above doesn't even need Wallpaper Engine to work, being suited for your beginner level. For the 1st choice I proposed, you'll have to wait and see if someone else who's using Wallpaper Engine is willing to provide you with another "demo code" that does everything for you with minimal effort from your part. ;-)

For the record, the above code is also suited for the 1st choice described in my 3rd reply from this thread, as long as the [Wallpaper] measure at step 4) is "converted" to a RunCommand measure that gets the path to the image file used by Wallpaper Engine as the current wallpaper, via its command line controls.
Followed the above steps but still no luck it doesn't work:
Here's the new code with changes as mentioned:

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!Refresh] 
LeftMouseDoubleClickAction=!ToggleConfig "Mond\Settings" "Settings.ini"

[Variables]
@include=#@#Variables.inc
@include2=#@#Language\#Language#.inc
Scale=1.16
ChangeInterval=5
WallpaperCount=2
Wallpaper1=D:\Data\Documents\Wallpaper Engine\projects\myprojects- Single -\01_gettyimages-502266246_resized.jpg
Wallpaper2=D:\Data\Documents\Wallpaper Engine\projects\myprojects- Single -\02_gettyimages-685083175_resized.jpg

[Wallpaper]
Measure=Calc
Formula=(Wallpaper % #WallpaperCount# + 1)
RegExpSubstitute=1
Substitute="^(.*)$":"[#Wallpaper\1]"
UpdateDivider=#ChangeInterval#
OnUpdateAction=[!SetWallpaper "[&Wallpaper]" Stretch][!SetOptionGroup Target Path "[&Wallpaper]"][!UpdateMeasure ChameleonDesktop]
DynamicVariables=1

[ChameleonDesktop]
Measure=Plugin
Plugin=Chameleon
Type=File
Path=[#Wallpaper1]
Group=Target

[Light1]
Measure=Plugin
Plugin=Chameleon
Parent=ChameleonDesktop
Format=Dec
Color=Light1
OnChangeAction=[!UpdateMeasureGroup Luminance]

[Dark1]
Measure=Plugin
Plugin=Chameleon
Parent=ChameleonDesktop
Format=Dec
Color=Dark1
OnChangeAction=[!UpdateMeasureGroup Luminance]

[ChameleonLuminance]
Measure=Plugin
Group=Target | Luminance
Plugin=Chameleon
Type=File
Path=[#Wallpaper1]
UpdateDivider=-1
CropX=#CURRENTCONFIGX#
CropY=#CURRENTCONFIGY#
CropW=#CURRENTCONFIGWIDTH#
CropH=#CURRENTCONFIGHEIGHT#
DynamicVariables=1

[Luminance]
Measure=Plugin
Group=Luminance
Plugin=Chameleon
Parent=ChameleonLuminance
Format=Dec
Color=Luminance
UpdateDivider=-1
IfCondition=Luminance <= 0.5
IfTrueAction=[!SetVariable Color1 "[Light1]"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable Color1 "[Dark1]"][!UpdateMeter *][!Redraw]
IfConditionMode=1

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureTime]
Measure=Time
Format="%#Format#:%M"

[MeasureAmPm]
Measure=Time
Format="%p"

[MeasureDay]
Measure=Time
Format=%A
Substitute=#Date#

[MeasureDate]
Measure=Time
Format=%d  %B  %Y
Substitute=#Date#

;-------------------------------------------------------------
;-------------------------------------------------------------

[Meter24hClock]
Meter=String
MeasureName=MeasureTime
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=#Color1#
FontSize=(30*#Scale#)
X=(325*#Scale#)
Y=(120*#Scale#)
Text="- %1 -"
AntiAlias=1
Hidden=#Hidden#
DynamicVariables=1

[Meter12hClock]
Meter=String
MeasureName=MeasureTime
MeasureName2=MeasureAmPm
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=#TextColor#
FontSize=(14*#Scale#)
X=(540*#Scale#)
Y=(320*#Scale#)
Text="- %1 %2 -"
AntiAlias=1
Hidden=#Hidden2#
DynamicVariables=1

[MeterDay]
Meter=String
MeasureName=MeasureDay
StringAlign=Center
StringCase=Upper
FontFace=Anurati
FontColor=#Color1#
FontSize=(40*#Scale#)
X=(340*#Scale#)
Y=(0*#Scale#)
Text="%1"
InlineSetting=CharacterSpacing | 10 | 10
AntiAlias=1
DynamicVariables=1
#TextColor#

[MeterDate]
Meter=String
MeasureName=MeasureDate
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=#Color1#
FontSize=(24*#Scale#)
X=(340*#Scale#)
Y=(75*#Scale#)
Text="%1"
AntiAlias=1
DynamicVariables=1
Screenshot 2024-06-29 155641.png
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Yincognito »

Taher wrote: June 29th, 2024, 10:30 am Followed the above steps but still no luck it doesn't work:
Here's the new code with changes as mentioned
From what I can see, you correctly followed all the steps and this should work (it certainly did for me, but I was too lazy to post a GIF preview earlier). Are you sure the paths to your images are correct? Does the wallpaper change from one image to another? Because if it does, then everything works properly as per what the OP code did (that’s your code, so you know best if it did what you actually wanted in its originally posted form). The screenshot also seems to indicate that it works, since the text color is close to what the colors in the wallpaper are. I know that the code should have probably chosen the light color in the screenshot, but that's what the OP code did, I didn't change any of that, just the wallpaper image the process was based on. :???:

EDIT: Maybe the fact that the wallpaper image is stretched to the entire screen plays a part in this, since the luminance measures crop the original image (and not the stretched one) based on the skin position and size...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Taher
Posts: 10
Joined: June 27th, 2024, 7:10 am

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Taher »

Yincognito wrote: June 29th, 2024, 11:13 am From what I can see, you correctly followed all the steps and this should work (it certainly did for me, but I was too lazy to post a GIF preview earlier). Are you sure the paths to your images are correct? Does the wallpaper change from one image to another? Because if it does, then everything works properly as per what the OP code did (that’s your code, so you know best if it did what you actually wanted in its originally posted form). The screenshot also seems to indicate that it works, since the text color is close to what the colors in the wallpaper are. I know that the code should have probably chosen the light color in the screenshot, but that's what the OP code did, I didn't change any of that, just the wallpaper image the process was based on. :???:

EDIT: Maybe the fact that the wallpaper image is stretched to the entire screen plays a part in this, since the luminance measures crop the original image (and not the stretched one) based on the skin position and size...

The path originally is D:\Data\Documents\Wallpaper Engine\projects\myprojects\02_gettyimages-685083175_resized.jpg

Okay so that - single - does it have any significance?

Also the playlist has live and more wallpapers too.
I just picked 2 and tested for it by setting it as the background in wallpaper engine.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Yincognito »

Taher wrote: June 29th, 2024, 11:52 am The path originally is D:\Data\Documents\Wallpaper Engine\projects\myprojects\02_gettyimages-685083175_resized.jpg

Okay so that - single - does it have any significance?

Also the playlist has live and more wallpapers too.
I just picked 2 and tested for it by setting it as the background in wallpaper engine.
That "- single -" was just part of the paths of my own images, so it's irrelevant for your case. You need to use your own paths for those 2 variables, obviously, just like you wrote it.

Again, Chameleon or Rainmeter won't work with live wallpapers, so that's out of the question and you did well choosing two actual image files. Also, the code above has nothing to do with Wallpaper Engine, the Rainmeter skin itself will change between those 2 wallpapers and set the Path option in the Chameleon measures accordingly.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Taher
Posts: 10
Joined: June 27th, 2024, 7:10 am

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Taher »

Yincognito wrote: June 29th, 2024, 12:06 pm That "- single -" was just part of the paths of my own images, so it's irrelevant for your case. You need to use your own paths for those 2 variables, obviously, just like you wrote it.

Again, Chameleon or Rainmeter won't work with live wallpapers, so that's out of the question and you did well choosing two actual image files. Also, the code above has nothing to do with Wallpaper Engine, the Rainmeter skin itself will change between those 2 wallpapers and set the Path option in the Chameleon measures accordingly.
Okay will update the path and get back to you.
Thanks for all the help.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Yincognito »

Taher wrote: June 29th, 2024, 12:13 pm Okay will update the path and get back to you.
Thanks for all the help.
You're welcome, glad to do so. Looking forward to your feedback after the path update. By the way, when testing, you could even (temporarily) exit Wallpaper Engine, to be sure it doesn't interfere with the wallpaper change done by the skin.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Taher
Posts: 10
Joined: June 27th, 2024, 7:10 am

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Taher »

Yincognito wrote: June 29th, 2024, 12:48 pm You're welcome, glad to do so. Looking forward to your feedback after the path update. By the way, when testing, you could even (temporarily) exit Wallpaper Engine, to be sure it doesn't interfere with the wallpaper change done by the skin.
I corrected the path and it works but only for static images I tried with gifs but it just sets the first frame as wallpaper.
the method for static wallpaper was already working as in my code previously shared using the windows wallpaper slideshow method... I wanted it to work for gifs(converted mp4s) and static both like in a playlist that's why I was using wallpaper engine.

Although I tried studying the process explained for wallpaper engine mentioned in step 1 but got lost in understanding it. :???: :?

Any help? :)
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Yincognito »

Taher wrote: July 1st, 2024, 7:22 am I corrected the path and it works but only for static images I tried with gifs but it just sets the first frame as wallpaper.
the method for static wallpaper was already working as in my code previously shared using the windows wallpaper slideshow method... I wanted it to work for gifs(converted mp4s) and static both like in a playlist that's why I was using wallpaper engine.

Although I tried studying the process explained for wallpaper engine mentioned in step 1 but got lost in understanding it. :???: :?

Any help? :)
Yeah, the GIF behavior is normal and expected: neither Rainmeter nor the Chameleon plugin can use anything other than the first frame in a GIF.

Damn, you're right, your OP code indeed would have worked if you already had Wallpaper Engine changing the wallpaper in the background. My bad, I totally missed that. :oops:

That being said, my code isn't all for nothing, since you'll need to do things exclusively from Rainmeter (no Wallpaper Engine needed) anyway, if you want Chameleon to work with multiframe GIFs.

The approach will take some time and effort from your part which I'm not sure you'll consider worthwhile, and it basically involves extracting all the individual frames from all your GIFs beforehand, and then just iterate through all the resulted plain / static images (both those extracted from the GIFs and your other non GIF ones) in the code I presented, see here two methods to approach it (I recommend the 1st one, since the 2nd will most likely create bitmaps with a resolution too large in this case):
https://docs.rainmeter.net/tips/animated-gif-files/

Of course, the images extracted from the GIFs will have to be "played" as wallpapers at a much higher frequency than the other ones in order to simulate the former GIF animation, but that should be possible by dynamically altering the UpdateDivider value (aka the ChangeInterval variable) in the [Wallpaper] measure. The result will most likely be quite CPU intensive, and you'll have to decide if you really want to go this route... :???:

For the record, Rainmeter can actually play GIFs or MP4s at a perfectly acceptable CPU usage through the WebView plugin by khanhas and a few lines of HTML code in a local webpage, but obviously that doesn't change the fact that the Chameleon plugin itself only works with plain (aka static) images:
https://forum.rainmeter.net/viewtopic.php?t=39233
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Taher
Posts: 10
Joined: June 27th, 2024, 7:10 am

Re: Chameleon to change skin color based on wallpaper engine wallpaper and not windows background

Post by Taher »

Yincognito wrote: July 1st, 2024, 10:51 am Yeah, the GIF behavior is normal and expected: neither Rainmeter nor the Chameleon plugin can use anything other than the first frame in a GIF.

Damn, you're right, your OP code indeed would have worked if you already had Wallpaper Engine changing the wallpaper in the background. My bad, I totally missed that. :oops:

That being said, my code isn't all for nothing, since you'll need to do things exclusively from Rainmeter (no Wallpaper Engine needed) anyway, if you want Chameleon to work with multiframe GIFs.

The approach will take some time and effort from your part which I'm not sure you'll consider worthwhile, and it basically involves extracting all the individual frames from all your GIFs beforehand, and then just iterate through all the resulted plain / static images (both those extracted from the GIFs and your other non GIF ones) in the code I presented, see here two methods to approach it (I recommend the 1st one, since the 2nd will most likely create bitmaps with a resolution too large in this case):
https://docs.rainmeter.net/tips/animated-gif-files/

Of course, the images extracted from the GIFs will have to be "played" as wallpapers at a much higher frequency than the other ones in order to simulate the former GIF animation, but that should be possible by dynamically altering the UpdateDivider value (aka the ChangeInterval variable) in the [Wallpaper] measure. The result will most likely be quite CPU intensive, and you'll have to decide if you really want to go this route... :???:

For the record, Rainmeter can actually play GIFs or MP4s at a perfectly acceptable CPU usage through the WebView plugin by khanhas and a few lines of HTML code in a local webpage, but obviously that doesn't change the fact that the Chameleon plugin itself only works with plain (aka static) images:
https://forum.rainmeter.net/viewtopic.php?t=39233
I thought of a work around:

Convert my mp4 live wallpapers to gif online (those which are project.json or .pkg files I'll screen record and convert to gif) and then use your proposed solution to set the wallpapers in rainmeter in exactly in the same order as present in the wallpaper engine playlist so when there will be live wallpapers rainmeter will have set the first frame in the background and due to which chameleon will redraw the colors and it will work as expected and as desired.

What do you think of it ?