It is currently February 22nd, 2019, 3:16 pm

SysColor plugin 1.1

Plugins and Addons popular with the Community
User avatar
ikarus1969
Posts: 320
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: SysColor plugin 1.1

ikarus1969 » October 8th, 2014, 6:00 am

Hi Brian!

i stumbled across a possible bug (i don't say that the bug is on my own coding but maybe you can help me out):

in a skin i retrieve the Aero-color. On an XP-system i still get a color together with the error message in the log that Aero could not be returned on XP. So far so good.

But on XP-systems i want to use another color than the one returned by the plugin, so i made a calc-measure which substitutes a little bit:

Code: Select all

[Measure_Aero_CALC]
Measure=CALC
Formula=Measure_Aero
RegexpSubstitute=1
Substitute="^1$":"[Measure_Aero]","^-1$":"C8D8D820"
But then i noticed that the plugin still returns 1 for Aero on XP systems as the numerical value.
I do that by:

Code: Select all

[Measure_Aero_NUM]
Measure=CALC
Formula=[Measure_Aero:]
DynamicVariables=1
Is it possible to get an -1 in this case? Or is there an error in my coding?
User avatar
Brian
Developer
Posts: 1847
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: SysColor plugin 1.1

Brian » October 8th, 2014, 4:37 pm

ikarus1969 wrote:Is it possible to get an -1 in this case? Or is there an error in my coding?
There is a smallish bug with my plugin that you have found. The default ColorType is "Desktop". So any invalid ColorType will default to the "Desktop" color type. On XP systems, any of the Aero/Win8/DWM color types are invalid, thus defaulting to "Desktop". This is why you get a color for the string value, and a "1" for the number value (along with an error message).

I will work on a fix for this.

-Brian
User avatar
Brian
Developer
Posts: 1847
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: SysColor plugin 1.1

Brian » October 8th, 2014, 6:00 pm

New version here: http://rainmeter.net/forum/viewtopic.php?p=80787#p80787

@ikarus1969: I believe I have fixed the issue. All invalid ColorTypes should now return -1.0 for the number value, and nothing for the string value. So on XP systems, if the ColorType is AERO (or Win8/DWM types), no color should be returned and a -1 should be the number value.

Thanks for reporting the issue!

-Brian
User avatar
ikarus1969
Posts: 320
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: SysColor plugin 1.1

ikarus1969 » October 9th, 2014, 5:39 am

Brian wrote:Thanks for reporting the issue!

-Brian
Thanks for creating this plugin and the fast response!

Now it works and as a side-effect i can easily detect if a system is Win-Xp or a later edition ;-)
Screenshot - Rainmeter.png
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 18879
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: SysColor plugin 1.1

jsmorley » February 9th, 2016, 6:02 pm

For Windows 10 "accent color", which about the only thing you can really set in Win10...

Gets the accent color, and evaluates the "brightness" of the color to determine if white or black would be used by Windows for the text on title bars, start menu, taskbar etc.

http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx

Works fine if you have Windows automatically setting the accent color based on your desktop wallpaper, which I personally would never do, as it is just shockingly ugly about 80% of the time.
Win10AcccentColor_1.0.rmskin
1.jpg
2.jpg
Requires uhm... Windows 10 to install the .rmskin.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureTitleBarRGB]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=RGB

[MeasureTitleBarRed]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=Red

[MeasureTitleBarGreen]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=Green

[MeasureTitleBarBlue]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=Blue

[MeasureTitleBarLumin]
Measure=Calc
Formula=(([MeasureTitleBarRed] * 299) + ([MeasureTitleBarGreen] * 587) + ([MeasureTitleBarBlue] * 114)) / 1000
IfBelowValue=130
IfBelowAction=[!SetVariable TitleBarTextColor "255,255,255,255"][!UpdateMeter *][!Redraw]
IfAboveValue=129
IfAboveAction=[!SetVariable TitleBarTextColor "0,0,0,255"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterTitleBar]
Meter=Image
W=300
H=36
SolidColor=[MeasureTitleBarRGB]
DynamicVariables=1

[MeterTitleText]
Meter=String
X=10
Y=18
StringAlign=LeftCenter
FontFace=Segoe UI
FontSize=11
FontColor=#TitleBarTextColor#
AntiAlias=1
DynamicVariables=1
InlineSetting=Weight | 100
InlinePattern=.*
Text=Windows Accent Color
------------------
P.S. Don't like the "bag of skittles" color choices that the color-blind 10-year-olds at Microsoft think we want for our desktop? Try this utility to set your own custom accent color.. WinAero.
You do not have the required permissions to view the files attached to this post.
DollarD
Posts: 16
Joined: March 2nd, 2013, 5:56 pm

Re: SysColor plugin 1.1

DollarD » February 9th, 2016, 6:13 pm

Ah, crap. How did I not know about the DWM_COLOR option?

I used a bit more... esoteric... method to get the accent color. This should make it a lot easier.

My solution was this: https://forum.rainmeter.net/viewtopic.php?f=15&t=21303

Sigh. Oh well.