Hello Rainmeter lovers
Please help me to create a widget with the system-wide theme.
I want the widget background to match the theme.
In this way, in the light theme, the background of the widget will be white.
And in the dark theme, the background of the widget will be black.
Also please see the issue below:
https://github.com/MinhThienDX/win10widgets/issues/30
There is information that may be helpful.
Thanks.
It is currently April 26th, 2024, 6:27 am
Help me to create a widget with the system-wide theme.
-
- Posts: 1
- Joined: June 8th, 2020, 6:44 pm
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help me to create a widget with the system-wide theme.
Sorry for the very late reply.
What you should do is to check the appropriate registry key (described into the posted link) and modify the color of a meter used as background accordingly.
So, first you need a Registry measure, to check the registry key. Add the following measure to your code:
Code: Select all
[MeasureWindowsTheme]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=Software\Microsoft\Windows\CurrentVersion\Themes\Personalize
RegValue=SystemUsesLightTheme
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterBackground SolidColor "0,0,0,150"][!UpdateMeter "MeterBackground"][!Redraw]
IfFalseAction=[!SetOption MeterBackground SolidColor "255,255,255,150"][!UpdateMeter "MeterBackground"][!Redraw]
Accordingly the [MeterBackground] meter is a simply Image meter. There is not needed to specifically set a SolidColor for it, because this option is set through the !SetOption bangs (as described above):
Code: Select all
[MeterBackground]
Meter=Image
X=0
Y=0
W=250
H=150
Please let me know if this is what you expect.