summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-08-16 16:56:58 +1000
committerailurux <ailuruxx@gmail.com>2024-08-16 16:56:58 +1000
commit0f9005626d2d919e6995809453b9b5ec3c72096b (patch)
treec647e9c92af4bc12308b35c0b29880ac9cceb80a
parent9cdb268b2bc5e30db9914b69db5d9763b3ddf656 (diff)
downloadtangara-fw-0f9005626d2d919e6995809453b9b5ec3c72096b.tar.gz
Redesigned many icons, added styles for battery icon recolouring based on percentage
-rw-r--r--lua/img/bat/0.pngbin627 -> 6267 bytes
-rw-r--r--lua/img/bat/0chg.pngbin627 -> 0 bytes
-rw-r--r--lua/img/bat/100.pngbin629 -> 6279 bytes
-rw-r--r--lua/img/bat/20.pngbin624 -> 6271 bytes
-rw-r--r--lua/img/bat/40.pngbin625 -> 6274 bytes
-rw-r--r--lua/img/bat/60.pngbin628 -> 6279 bytes
-rw-r--r--lua/img/bat/80.pngbin623 -> 6279 bytes
-rw-r--r--lua/img/bat/chg.pngbin667 -> 6259 bytes
-rw-r--r--lua/img/bt.pngbin9652 -> 10120 bytes
-rw-r--r--lua/img/bt_conn.pngbin11355 -> 11932 bytes
-rw-r--r--lua/theme_dark.lua23
-rw-r--r--lua/theme_light.lua24
-rw-r--r--lua/widgets.lua18
13 files changed, 59 insertions, 6 deletions
diff --git a/lua/img/bat/0.png b/lua/img/bat/0.png
index 15639ef5..a0e0e480 100644
--- a/lua/img/bat/0.png
+++ b/lua/img/bat/0.png
Binary files differ
diff --git a/lua/img/bat/0chg.png b/lua/img/bat/0chg.png
deleted file mode 100644
index 7267ade1..00000000
--- a/lua/img/bat/0chg.png
+++ /dev/null
Binary files differ
diff --git a/lua/img/bat/100.png b/lua/img/bat/100.png
index f762ec2f..caf2a160 100644
--- a/lua/img/bat/100.png
+++ b/lua/img/bat/100.png
Binary files differ
diff --git a/lua/img/bat/20.png b/lua/img/bat/20.png
index b1fcca1b..e440d1bf 100644
--- a/lua/img/bat/20.png
+++ b/lua/img/bat/20.png
Binary files differ
diff --git a/lua/img/bat/40.png b/lua/img/bat/40.png
index fbba9c3b..4a9dacaa 100644
--- a/lua/img/bat/40.png
+++ b/lua/img/bat/40.png
Binary files differ
diff --git a/lua/img/bat/60.png b/lua/img/bat/60.png
index 97a8b605..a8ed889f 100644
--- a/lua/img/bat/60.png
+++ b/lua/img/bat/60.png
Binary files differ
diff --git a/lua/img/bat/80.png b/lua/img/bat/80.png
index ab90987b..4e02261b 100644
--- a/lua/img/bat/80.png
+++ b/lua/img/bat/80.png
Binary files differ
diff --git a/lua/img/bat/chg.png b/lua/img/bat/chg.png
index d604bb76..89fd8368 100644
--- a/lua/img/bat/chg.png
+++ b/lua/img/bat/chg.png
Binary files differ
diff --git a/lua/img/bt.png b/lua/img/bt.png
index 24127267..ae45dfbf 100644
--- a/lua/img/bt.png
+++ b/lua/img/bt.png
Binary files differ
diff --git a/lua/img/bt_conn.png b/lua/img/bt_conn.png
index e26ad218..890e4160 100644
--- a/lua/img/bt_conn.png
+++ b/lua/img/bt_conn.png
Binary files differ
diff --git a/lua/theme_dark.lua b/lua/theme_dark.lua
index 20d64495..a908245f 100644
--- a/lua/theme_dark.lua
+++ b/lua/theme_dark.lua
@@ -211,6 +211,29 @@ local theme_dark = {
radius = 4
}},
},
+ battery = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 0,
+ }},
+ },
+ battery_0 = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 180,
+ image_recolor = "#aa3333",
+ }},
+ },
+ battery_charging = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 180,
+ image_recolor = "#33aa33",
+ }},
+ },
+ battery_charge_icon = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 180,
+ image_recolor = "#fdd833",
+ }},
+ },
}
return theme_dark
diff --git a/lua/theme_light.lua b/lua/theme_light.lua
index ce728c7c..e856c015 100644
--- a/lua/theme_light.lua
+++ b/lua/theme_light.lua
@@ -246,6 +246,30 @@ local theme_light = {
radius = 4
}},
},
+ battery = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 180,
+ image_recolor = highlight_color,
+ }},
+ },
+ battery_0 = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 180,
+ image_recolor = "#aa3333",
+ }},
+ },
+ battery_charging = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 180,
+ image_recolor = "#33aa33",
+ }},
+ },
+ battery_charge_icon = {
+ {lvgl.PART.MAIN, lvgl.Style {
+ image_recolor_opa = 180,
+ image_recolor = "#fdd833",
+ }},
+ },
}
return theme_light
diff --git a/lua/widgets.lua b/lua/widgets.lua
index 4e83393e..29e50f29 100644
--- a/lua/widgets.lua
+++ b/lua/widgets.lua
@@ -19,7 +19,6 @@ local img = {
bat_40 = lvgl.ImgData("//lua/img/bat/40.png"),
bat_20 = lvgl.ImgData("//lua/img/bat/20.png"),
bat_0 = lvgl.ImgData("//lua/img/bat/0.png"),
- bat_0chg = lvgl.ImgData("//lua/img/bat/0chg.png"),
bt_conn = lvgl.ImgData("//lua/img/bt_conn.png"),
bt = lvgl.ImgData("//lua/img/bt.png")
}
@@ -102,6 +101,7 @@ function widgets.StatusBar(parent, opts)
pad_top = 1,
pad_bottom = 1,
pad_left = 4,
+ pad_right = 4,
pad_column = 1,
scrollbar_mode = lvgl.SCROLLBAR_MODE.OFF,
}
@@ -157,24 +157,29 @@ function widgets.StatusBar(parent, opts)
local function update_battery_icon()
if is_charging == nil or percent == nil then return end
local src
+ theme.set_style(battery_icon, "battery")
if percent >= 95 then
+ theme.set_style(battery_icon, "battery_100")
src = img.bat_100
elseif percent >= 75 then
+ theme.set_style(battery_icon, "battery_80")
src = img.bat_80
elseif percent >= 55 then
+ theme.set_style(battery_icon, "battery_60")
src = img.bat_60
elseif percent >= 35 then
+ theme.set_style(battery_icon, "battery_40")
src = img.bat_40
elseif percent >= 15 then
+ theme.set_style(battery_icon, "battery_20")
src = img.bat_20
else
- if is_charging then
- src = img.bat_0chg
- else
- src = img.bat_0
- end
+ theme.set_style(battery_icon, "battery_0")
+ src = img.bat_0
end
if is_charging then
+ theme.set_style(battery_icon, "battery_charging")
+ theme.set_style(charge_icon, "battery_charge_icon")
charge_icon:clear_flag(lvgl.FLAG.HIDDEN)
else
charge_icon:add_flag(lvgl.FLAG.HIDDEN)
@@ -206,6 +211,7 @@ function widgets.StatusBar(parent, opts)
end
end),
bluetooth.connected:bind(function(connected)
+ theme.set_style(bt_icon, "bluetooth_icon")
if connected then
bt_icon:set_src(img.bt_conn)
else