minor: use predefined color instead of gray method

pull/2151/head
Qingping Hou 8 years ago
parent 15ace2cb7f
commit a10a4f65a5

@ -93,7 +93,7 @@ function ReaderCropping:onPageCrop(mode)
self.orig_view_dimen = Geom:new{w = self.view.dimen.w, h = self.view.dimen.h}
-- backup original view bgcolor
self.orig_view_bgcolor = self.view.outer_page_color
self.view.outer_page_color = Blitbuffer.gray(0.5) -- gray bgcolor
self.view.outer_page_color = Blitbuffer.COLOR_GREY
-- backup original page scroll
self.orig_page_scroll = self.view.page_scroll
self.view.page_scroll = false

@ -43,7 +43,7 @@ local ReaderView = OverlapGroup:new{
page_gap = {
width = Screen:scaleBySize(8),
height = Screen:scaleBySize(8),
color = Blitbuffer.gray(0.5),
color = Blitbuffer.COLOR_GREY,
},
-- DjVu page rendering mode (used in djvu.c:drawPage())
render_mode = DRENDER_MODE, -- default to COLOR

@ -35,7 +35,7 @@ function Button:init()
if self.text then
self.label_widget = TextWidget:new{
text = self.text,
fgcolor = Blitbuffer.gray(self.enabled and 1.0 or 0.5),
fgcolor = self.enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
bold = self.text_font_bold,
face = Font:getFace(self.text_font_face, self.text_font_size)
}
@ -114,7 +114,11 @@ end
function Button:enable()
self.enabled = true
if self.text then
self.label_widget.fgcolor = Blitbuffer.gray(self.enabled and 1.0 or 0.5)
if self.enabled then
self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK
else
self.label_widget.fgcolor = Blitbuffer.COLOR_GREY
end
else
self.label_widget.dim = not self.enabled
end
@ -123,7 +127,11 @@ end
function Button:disable()
self.enabled = false
if self.text then
self.label_widget.fgcolor = Blitbuffer.gray(self.enabled and 1.0 or 0.5)
if self.enabled then
self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK
else
self.label_widget.fgcolor = Blitbuffer.COLOR_GREY
end
else
self.label_widget.dim = not self.enabled
end

@ -55,7 +55,7 @@ function ButtonTable:init()
}
local button_dim = button:getSize()
local vertical_sep = LineWidget:new{
background = Blitbuffer.gray(0.5),
background = Blitbuffer.COLOR_GREY,
dimen = Geom:new{
w = self.sep_width,
h = button_dim.h,
@ -85,7 +85,7 @@ function ButtonTable:addHorizontalSep()
table.insert(self.container,
VerticalSpan:new{ width = Screen:scaleBySize(2) })
table.insert(self.container, LineWidget:new{
background = Blitbuffer.gray(0.5),
background = Blitbuffer.COLOR_GREY,
dimen = Geom:new{
w = self.width,
h = self.sep_width,

@ -212,7 +212,6 @@ function DictQuickLookup:update()
show_parent = self,
}
local title_bar = LineWidget:new{
--background = Blitbuffer.gray(0.5),
dimen = Geom:new{
w = button_table:getSize().w + self.button_padding,
h = Screen:scaleBySize(2),

@ -113,7 +113,7 @@ function InputText:initTextBox(text)
bordersize = self.bordersize,
padding = self.padding,
margin = self.margin,
color = Blitbuffer.gray(self.focused and 1.0 or 0.5),
color = self.focused and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
self.text_widget,
}
self.dimen = self[1]:getSize()
@ -138,7 +138,7 @@ end
function InputText:unfocus()
self.focused = false
self.text_widget:unfocus()
self[1].color = Blitbuffer.gray(0.5)
self[1].color = Blitbuffer.COLOR_GREY
end
function InputText:focus()

@ -8,7 +8,7 @@ local Blitbuffer = require("ffi/blitbuffer")
local LinkBox = InputContainer:new{
box = nil,
color = Blitbuffer.gray(0.5),
color = Blitbuffer.COLOR_GREY,
radius = 0,
bordersize = 2,
}

@ -28,7 +28,7 @@ local ToggleSwitch = InputContainer:new{
width = Screen:scaleBySize(216),
height = Screen:scaleBySize(30),
bgcolor = Blitbuffer.COLOR_WHITE, -- unfoused item color
fgcolor = Blitbuffer.gray(0.5), -- focused item color
fgcolor = Blitbuffer.COLOR_GREY, -- focused item color
font_face = "cfont",
font_size = 16,
enabled = true,
@ -42,7 +42,7 @@ function ToggleSwitch:init()
self.toggle_frame = FrameContainer:new{
background = Blitbuffer.COLOR_WHITE,
color = Blitbuffer.gray(0.5),
color = Blitbuffer.COLOR_GREY,
radius = 7,
bordersize = 1,
padding = 2,
@ -70,7 +70,7 @@ function ToggleSwitch:init()
}
local button = FrameContainer:new{
background = Blitbuffer.COLOR_WHITE,
color = Blitbuffer.gray(0.5),
color = Blitbuffer.COLOR_GREY,
margin = 0,
radius = 5,
bordersize = 1,

@ -79,7 +79,7 @@ function TouchMenuItem:init()
},
TextWidget:new{
text = self.item.text or self.item.text_func(),
fgcolor = Blitbuffer.gray(item_enabled ~= false and 1.0 or 0.5),
fgcolor = item_enabled ~= false and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY,
face = self.face,
},
},

Loading…
Cancel
Save