From ead331924f7d8eb29e1f1a42fb4641fe0f0792da Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 13 Oct 2013 16:52:32 +0800 Subject: [PATCH] fix toggle color inconsistency --- frontend/ui/widget/toggleswitch.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/ui/widget/toggleswitch.lua b/frontend/ui/widget/toggleswitch.lua index 620ad5059..47a31819a 100644 --- a/frontend/ui/widget/toggleswitch.lua +++ b/frontend/ui/widget/toggleswitch.lua @@ -11,6 +11,8 @@ end ToggleSwitch = InputContainer:new{ width = scaleByDPI(216), height = scaleByDPI(30), + bgcolor = 0, -- unfoused item color + fgcolor = 7, -- focused item color } function ToggleSwitch:init() @@ -65,13 +67,13 @@ function ToggleSwitch:update() local pos = self.position for i=1,#self.toggle_content do if pos == i then - self.toggle_content[i].color = 7 - self.toggle_content[i].background = 7 - self.toggle_content[i][1][1].bgcolor = 0.5 + self.toggle_content[i].color = self.fgcolor + self.toggle_content[i].background = self.fgcolor + self.toggle_content[i][1][1].bgcolor = self.fgcolor/15 self.toggle_content[i][1][1].fgcolor = 0.0 else - self.toggle_content[i].color = 0 - self.toggle_content[i].background = 0 + self.toggle_content[i].color = self.bgcolor + self.toggle_content[i].background = self.bgcolor self.toggle_content[i][1][1].bgcolor = 0.0 self.toggle_content[i][1][1].fgcolor = 1.0 end