0

这是一个有点奇怪的问题。我有一个电池皮肤,它应该根据当前的电池百分比动态改变颜色。但是,不会出现 RGB 中的任何正红色值。下面包含完整的皮肤代码,如果需要,可以提供问题的屏幕截图。

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
COLORBKGD=255,255,255,255
COLORMEASURE=0,255,0,255

[MeasureBatteryStatus]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Status
IfCondition=MeasureBatteryStatus = 1
IfFalseAction=[!SetOption MeterIcon ImageName "#@#power.png"][!Redraw]
IfTrueAction=[!SetOption MeterIcon ImageName "#@#powerCharging.png"][!Redraw]

[MeasureGreenValue]
Measure=Calc
Formula=Floor([MeasureBatteryPct] < 25 ? 0 : ([MeasureBatteryPct] > 75 ? 255 : ([MeasureBatteryPct] - 25) / 50 * 255))
DynamicVariables=1

[MeasureRedValue]
Measure=Calc
Formula=Floor([MeasureBatteryPct] > 75 ? 0 : ([MeasureBatteryPct] < 25 ? 255 : (1 - ([MeasureBatteryPct] - 25) / 50) * 255))
DynamicVariables=1


[MeasureBatteryPct]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent
DynamicVariables=1
OnUpdateAction=[!SetVariable COLORMEASURE ([MeasureRedValue],[MeasureGreenValue],0,255)][!SetOption MeterBatteryPct LineColor #COLORMEASURE#][!Redraw]

[MeterIcon]
Meter=Image
ImageName="#@#power.png"
X=8
Y=7
W=48
PreserveAspectRatio=1

[MeterBkgd]
Meter=Roundline
X=0
Y=0
W=64
H=64
RotationAngle=(2*PI)
LineWidth=16
LineLength=29
LineStart=28
AntiAlias=1
Solid=1
LineColor=#COLORBKGD#

[MeterBatteryPct]
Meter=Roundline
MeasureName=MeasureBatteryPct
X=0
Y=0
W=64
H=64
StartAngle=(3*PI/2)
RotationAngle=(2*PI)
LineLength=31
Solid=1
AntiAlias=1
LineColor=255,0,0,255
LineStart=26
DynamicVariables=1
4

1 回答 1

0

好的,我几个小时前解决了。我可以在工作代码和我最初发布的代码之间找到的唯一显着区别是 COLORMEASURE 分配值周围的括号:

OnUpdateAction=[!SetVariable COLORMEASURE ([MeasureRedValue],[MeasureGreenValue],0,255)][!SetOption MeterBatteryPct LineColor #COLORMEASURE#][!Redraw]

在这一点上,我不确定这是否是问题的原因,但无论如何问题都已解决。

于 2015-01-24T04:10:23.043 回答