feat: added Based on utilization color option for Bar chart widget in the Battery module (#865)

This commit is contained in:
Serhiy Mytrovtsiy
2022-03-10 18:50:07 +01:00
parent 833c210826
commit e422278791
3 changed files with 4 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ public class BarChart: WidgetWrapper {
if partitionValue.color == nil {
switch self.colorState {
case .systemAccent: controlAccentColor.set()
case .utilization: partitionValue.value.usageColor(zones: self.colorZones).setFill()
case .utilization: partitionValue.value.usageColor(zones: self.colorZones, reversed: self.title == "Battery").setFill()
case .pressure: self.pressureLevel.pressureColor().setFill()
case .monochrome:
if self.boxState {

View File

@@ -54,7 +54,6 @@
</dict>
<key>Unsupported colors</key>
<array>
<string>utilization</string>
<string>pressure</string>
</array>
<key>Order</key>

View File

@@ -117,7 +117,9 @@ public class Battery: Module {
case let widget as Mini:
widget.setValue(abs(value.level))
widget.setColorZones((0.15, 0.3))
case let widget as BarChart: widget.setValue([[ColorValue(value.level)]])
case let widget as BarChart:
widget.setValue([[ColorValue(value.level)]])
widget.setColorZones((0.15, 0.3))
case let widget as BatterykWidget:
widget.setValue(
percentage: value.level ,