diff --git a/frontend/apps/filemanager/filemanagermenu.lua b/frontend/apps/filemanager/filemanagermenu.lua index 97115e8ac..4b8787ea0 100644 --- a/frontend/apps/filemanager/filemanagermenu.lua +++ b/frontend/apps/filemanager/filemanagermenu.lua @@ -229,7 +229,7 @@ function FileManagerMenu:setUpdateItemTable() else dbg:setVerbose(false) dbg:turnOff() - G_reader_settings:flipTrue("debug_verbose") + G_reader_settings:flipFalse("debug_verbose") end end, }, diff --git a/frontend/apps/reader/modules/readercropping.lua b/frontend/apps/reader/modules/readercropping.lua index d6c8ccb79..ad0e3bdba 100644 --- a/frontend/apps/reader/modules/readercropping.lua +++ b/frontend/apps/reader/modules/readercropping.lua @@ -95,7 +95,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.COLOR_GREY + self.view.outer_page_color = Blitbuffer.COLOR_DARK_GRAY -- backup original page scroll self.orig_page_scroll = self.view.page_scroll self.view.page_scroll = false diff --git a/frontend/apps/reader/modules/readerdogear.lua b/frontend/apps/reader/modules/readerdogear.lua index 7f5f15f9e..06ef46884 100644 --- a/frontend/apps/reader/modules/readerdogear.lua +++ b/frontend/apps/reader/modules/readerdogear.lua @@ -35,7 +35,6 @@ function ReaderDogear:setupDogear(new_dogear_size) dimen = Geom:new{w = Screen:getWidth(), h = self.dogear_size}, ImageWidget:new{ file = "resources/icons/dogear.png", - alpha = true, width = self.dogear_size, height = self.dogear_size, } diff --git a/frontend/apps/reader/modules/readerview.lua b/frontend/apps/reader/modules/readerview.lua index 0ade71b09..66e33415c 100644 --- a/frontend/apps/reader/modules/readerview.lua +++ b/frontend/apps/reader/modules/readerview.lua @@ -539,7 +539,7 @@ function ReaderView:drawHighlightRect(bb, _x, _y, rect, drawer) if drawer == "underscore" then self.highlight.line_width = self.highlight.line_width or 2 - self.highlight.line_color = self.highlight.line_color or Blitbuffer.gray(0.33) + self.highlight.line_color = self.highlight.line_color or Blitbuffer.COLOR_GRAY bb:paintRect(x, y+h-1, w, self.highlight.line_width, self.highlight.line_color) diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index 6d6996a7d..d1877860e 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -211,7 +211,9 @@ function Device:onPowerEvent(ev) G_reader_settings:readSetting("screensaver_type") == "cover" or G_reader_settings:readSetting("screensaver_type") == "random_image" or G_reader_settings:readSetting("screensaver_type") == "image_file" then - self.screen:clear(self.screen:getScreenWidth(), self.screen:getScreenHeight()) + if not G_reader_settings:isTrue("screensaver_no_background") then + self.screen:clear(self.screen:getScreenWidth(), self.screen:getScreenHeight()) + end self.screen:refreshFull() end else diff --git a/frontend/luasettings.lua b/frontend/luasettings.lua index 0bdb5b643..0b14f3a39 100644 --- a/frontend/luasettings.lua +++ b/frontend/luasettings.lua @@ -150,7 +150,7 @@ function LuaSettings:flipFalse(key) if self:isFalse(key) then self:delSetting(key) else - self:saveSetting(key, true) + self:saveSetting(key, false) end return self end diff --git a/frontend/ui/elements/screensaver_menu.lua b/frontend/ui/elements/screensaver_menu.lua index 8c3e588a8..67af99a97 100644 --- a/frontend/ui/elements/screensaver_menu.lua +++ b/frontend/ui/elements/screensaver_menu.lua @@ -11,6 +11,7 @@ local function lastFile() end end local function whiteBackground() return G_reader_settings:isTrue("screensaver_white_background") end +local function noBackground() return G_reader_settings:isTrue("screensaver_no_background") end local function stretchImages() return G_reader_settings:isTrue("screensaver_stretch_images") end return { @@ -137,6 +138,15 @@ return { checked_func = whiteBackground, callback = function() G_reader_settings:saveSetting("screensaver_white_background", not whiteBackground()) + G_reader_settings:flipFalse("screensaver_no_background") + end, + }, + { + text = _("Leave background as-is behind message and images"), + checked_func = noBackground, + callback = function() + G_reader_settings:saveSetting("screensaver_no_background", not noBackground()) + G_reader_settings:flipFalse("screensaver_white_background") end, }, { diff --git a/frontend/ui/screensaver.lua b/frontend/ui/screensaver.lua index 8c66d2d1a..4f7214cea 100644 --- a/frontend/ui/screensaver.lua +++ b/frontend/ui/screensaver.lua @@ -166,6 +166,10 @@ function Screensaver:whiteBackground() return G_reader_settings:isTrue("screensaver_white_background") end +function Screensaver:noBackground() + return G_reader_settings:isTrue("screensaver_no_background") +end + function Screensaver:excluded() local lastfile = G_reader_settings:readSetting("lastfile") local exclude_ss = false -- consider it not excluded if there's no docsetting @@ -237,7 +241,12 @@ function Screensaver:show(event, fallback_message) return end local widget = nil - local background = Blitbuffer.COLOR_WHITE + local background = Blitbuffer.COLOR_BLACK + if self:whiteBackground() then + background = Blitbuffer.COLOR_WHITE + elseif self:noBackground() then + background = nil + end if screensaver_type == "cover" then local lastfile = G_reader_settings:readSetting("lastfile") local exclude = false -- consider it not excluded if there's no docsetting @@ -258,14 +267,10 @@ function Screensaver:show(event, fallback_message) widget = ImageWidget:new{ image = image, image_disposable = true, - alpha = true, height = Screen:getHeight(), width = Screen:getWidth(), scale_factor = not self:stretchImages() and 0 or nil, } - if not self:whiteBackground() then - background = Blitbuffer.COLOR_BLACK - end else screensaver_type = "random_image" end @@ -320,9 +325,6 @@ function Screensaver:show(event, fallback_message) width = Screen:getWidth(), scale_factor = not self:stretchImages() and 0 or nil, } - if not self:whiteBackground() then - background = Blitbuffer.COLOR_BLACK - end end end if screensaver_type == "image_file" then @@ -344,9 +346,6 @@ function Screensaver:show(event, fallback_message) width = Screen:getWidth(), scale_factor = not self:stretchImages() and 0 or nil, } - if not self:whiteBackground() then - background = Blitbuffer.COLOR_BLACK - end end end if screensaver_type == "readingprogress" then diff --git a/frontend/ui/widget/bookstatuswidget.lua b/frontend/ui/widget/bookstatuswidget.lua index 624f429dc..e9176ab59 100644 --- a/frontend/ui/widget/bookstatuswidget.lua +++ b/frontend/ui/widget/bookstatuswidget.lua @@ -174,7 +174,7 @@ function BookStatusWidget:genHeader(title) local header_title = TextWidget:new{ text = title, face = self.medium_font_face, - fgcolor = Blitbuffer.gray(0.4), + fgcolor = Blitbuffer.COLOR_WEB_GRAY, } local padding_span = HorizontalSpan:new{ width = self.padding } @@ -182,7 +182,7 @@ function BookStatusWidget:genHeader(title) local line_container = LeftContainer:new{ dimen = Geom:new{ w = line_width, h = height }, LineWidget:new{ - background = Blitbuffer.gray(0.2), + background = Blitbuffer.COLOR_LIGHT_GRAY, dimen = Geom:new{ w = line_width, h = Size.line.thick, diff --git a/frontend/ui/widget/button.lua b/frontend/ui/widget/button.lua index c006e7160..8b41f5d9e 100644 --- a/frontend/ui/widget/button.lua +++ b/frontend/ui/widget/button.lua @@ -52,7 +52,7 @@ function Button:init() self.label_widget = TextWidget:new{ text = self.text, max_width = self.max_width and self.max_width - 2*self.padding - 2*self.margin - 2*self.bordersize or nil, - fgcolor = self.enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY, + fgcolor = self.enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY, bold = self.text_font_bold, face = Font:getFace(self.text_font_face, self.text_font_size) } @@ -144,7 +144,7 @@ function Button:enable() if self.enabled then self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK else - self.label_widget.fgcolor = Blitbuffer.COLOR_GREY + self.label_widget.fgcolor = Blitbuffer.COLOR_DARK_GRAY end else self.label_widget.dim = not self.enabled @@ -157,7 +157,7 @@ function Button:disable() if self.enabled then self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK else - self.label_widget.fgcolor = Blitbuffer.COLOR_GREY + self.label_widget.fgcolor = Blitbuffer.COLOR_DARK_GRAY end else self.label_widget.dim = not self.enabled diff --git a/frontend/ui/widget/buttonprogresswidget.lua b/frontend/ui/widget/buttonprogresswidget.lua index 33d69668a..431959bae 100644 --- a/frontend/ui/widget/buttonprogresswidget.lua +++ b/frontend/ui/widget/buttonprogresswidget.lua @@ -25,7 +25,7 @@ local ButtonProgressWidget = InputContainer:new{ function ButtonProgressWidget:init() self.buttonprogress_frame = FrameContainer:new{ background = Blitbuffer.COLOR_WHITE, - color = Blitbuffer.COLOR_GREY, + color = Blitbuffer.COLOR_DARK_GRAY, radius = Size.radius.window, bordersize = 0, padding = self.padding, @@ -73,9 +73,9 @@ function ButtonProgressWidget:update() end, } if self.thin_grey_style then - button.frame.color = Blitbuffer.COLOR_GREY -- no black border around grey squares + button.frame.color = Blitbuffer.COLOR_DARK_GRAY -- no black border around gray squares if highlighted then - button.frame.background = Blitbuffer.COLOR_GREY + button.frame.background = Blitbuffer.COLOR_DARK_GRAY button = FrameContainer:new{ -- add margin back margin = button_margin, padding = 0, diff --git a/frontend/ui/widget/buttontable.lua b/frontend/ui/widget/buttontable.lua index 22fdda267..700a5a60a 100644 --- a/frontend/ui/widget/buttontable.lua +++ b/frontend/ui/widget/buttontable.lua @@ -68,7 +68,7 @@ function ButtonTable:init() end local button_dim = button:getSize() local vertical_sep = LineWidget:new{ - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, dimen = Geom:new{ w = self.sep_width, h = button_dim.h, @@ -106,7 +106,7 @@ function ButtonTable:addHorizontalSep(vspan_before, add_line, vspan_after, black end if add_line then table.insert(self.container, LineWidget:new{ - background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY, + background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY, dimen = Geom:new{ w = self.width, h = self.sep_width, diff --git a/frontend/ui/widget/checkmark.lua b/frontend/ui/widget/checkmark.lua index 664c527e0..dd836e3c6 100644 --- a/frontend/ui/widget/checkmark.lua +++ b/frontend/ui/widget/checkmark.lua @@ -41,12 +41,12 @@ function CheckMark:init() local disabled_checked_widget = TextWidget:new{ text = " ✓", -- preceded by thin space for better alignment face = self.face, - fgcolor = Blitbuffer.COLOR_GREY, + fgcolor = Blitbuffer.COLOR_DARK_GRAY, } local disabled_unchecked_widget = TextWidget:new{ text = "▢ ", face = self.face, - fgcolor = Blitbuffer.COLOR_GREY, + fgcolor = Blitbuffer.COLOR_DARK_GRAY, } local empty_widget = TextWidget:new{ text = "", diff --git a/frontend/ui/widget/configdialog.lua b/frontend/ui/widget/configdialog.lua index a9c48795c..47bdc07c1 100644 --- a/frontend/ui/widget/configdialog.lua +++ b/frontend/ui/widget/configdialog.lua @@ -386,12 +386,12 @@ function ConfigOption:init() FixedTextWidget:new{ text = self.options[c].item_text[d], face = Font:getFace(item_font_face, item_font_size[d]), - fgcolor = Blitbuffer.gray(enabled and 1.0 or 0.5), + fgcolor = enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY, }, underline_padding = padding_button, padding_left = d > 1 and horizontal_half_padding, padding_right = d < #self.options[c].item_text and horizontal_half_padding, - color = d == current_item and Blitbuffer.gray(enabled and 1.0 or 0.5) or Blitbuffer.COLOR_WHITE, + color = d == current_item and enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY or Blitbuffer.COLOR_WHITE, enabled = enabled, } else @@ -405,12 +405,12 @@ function ConfigOption:init() TextWidget:new{ text = text, face = face, - fgcolor = Blitbuffer.gray(enabled and 1.0 or 0.5), + fgcolor = enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY, }, underline_padding = -padding_button, padding_left = d > 1 and horizontal_half_padding, padding_right = d < #self.options[c].item_text and horizontal_half_padding, - color = d == current_item and Blitbuffer.gray(enabled and 1.0 or 0.5) or Blitbuffer.COLOR_WHITE, + color = d == current_item and enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY or Blitbuffer.COLOR_WHITE, enabled = enabled, } end @@ -448,7 +448,7 @@ function ConfigOption:init() underline_padding = -padding_button, padding_left = d > 1 and horizontal_half_padding, padding_right = d < #self.options[c].item_icons and horizontal_half_padding, - color = d == current_item and Blitbuffer.gray(enabled and 1.0 or 0.5) or Blitbuffer.COLOR_WHITE, + color = d == current_item and enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY or Blitbuffer.COLOR_WHITE, enabled = enabled, } option_items[d] = option_item diff --git a/frontend/ui/widget/frontlightwidget.lua b/frontend/ui/widget/frontlightwidget.lua index dd7ae6e8f..1ad61a113 100644 --- a/frontend/ui/widget/frontlightwidget.lua +++ b/frontend/ui/widget/frontlightwidget.lua @@ -299,7 +299,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group) if self.powerd.auto_warmth then enable_button_plus = false enable_button_minus = false - button_color = Blitbuffer.COLOR_GREY + button_color = Blitbuffer.COLOR_DARK_GRAY else if math.floor(num_warmth / self.nl_scale) <= self.nl_min then enable_button_minus = false end if math.ceil(num_warmth / self.nl_scale) >= self.nl_max then enable_button_plus = false end @@ -413,7 +413,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group) face = self.larger_font_face, alignment = "right", fgcolor = self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or - Blitbuffer.COLOR_GREY, + Blitbuffer.COLOR_DARK_GRAY, width = self.screen_width * 0.3 } local text_hour = TextBoxWidget:new{ @@ -422,7 +422,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group) face = self.larger_font_face, alignment = "center", fgcolor =self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or - Blitbuffer.COLOR_GREY, + Blitbuffer.COLOR_DARK_GRAY, width = self.screen_width * 0.15 } local button_minus_one_hour = Button:new{ diff --git a/frontend/ui/widget/imageviewer.lua b/frontend/ui/widget/imageviewer.lua index ddbb23bd0..02f119999 100644 --- a/frontend/ui/widget/imageviewer.lua +++ b/frontend/ui/widget/imageviewer.lua @@ -348,7 +348,7 @@ function ImageViewer:update() file = self.file, image = self.image, image_disposable = false, -- we may re-use self.image - alpha = true, + alpha = true, -- we might be showing images with an alpha channel (f.g., from Wikipedia) width = max_image_w, height = max_image_h, rotation_angle = rotation_angle, diff --git a/frontend/ui/widget/imagewidget.lua b/frontend/ui/widget/imagewidget.lua index b29b1b792..f6d4c6763 100644 --- a/frontend/ui/widget/imagewidget.lua +++ b/frontend/ui/widget/imagewidget.lua @@ -20,6 +20,7 @@ Show image from memory example: ]] +local Blitbuffer = require("ffi/blitbuffer") local Cache = require("cache") local CacheItem = require("cacheitem") local Geom = require("ui/geometry") @@ -355,7 +356,13 @@ function ImageWidget:paintTo(bb, x, y) } logger.dbg("blitFrom", x, y, self._offset_x, self._offset_y, size.w, size.h) if self.alpha == true then - bb:alphablitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h) + -- Only actually try to alpha-blend if the image really has an alpha channel... + local bbtype = self._bb:getType() + if bbtype == Blitbuffer.TYPE_BB8A or bbtype == Blitbuffer.TYPE_BBRGB32 then + bb:alphablitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h) + else + bb:blitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h) + end else bb:blitFrom(self._bb, x, y, self._offset_x, self._offset_y, size.w, size.h) end diff --git a/frontend/ui/widget/infomessage.lua b/frontend/ui/widget/infomessage.lua index 25e1a0066..aa9dea4d1 100644 --- a/frontend/ui/widget/infomessage.lua +++ b/frontend/ui/widget/infomessage.lua @@ -96,7 +96,6 @@ function InfoMessage:init() image_widget = ImageWidget:new{ file = self.icon_file or "resources/info-i.png", scale_for_dpi = true, - alpha = true, } end else diff --git a/frontend/ui/widget/inputtext.lua b/frontend/ui/widget/inputtext.lua index d88122e0b..c7a5da144 100644 --- a/frontend/ui/widget/inputtext.lua +++ b/frontend/ui/widget/inputtext.lua @@ -237,7 +237,7 @@ function InputText:initTextBox(text, char_added) if show_text == "" or show_text == nil then -- no preset value, use hint text if set show_text = self.hint - fgcolor = Blitbuffer.COLOR_GREY + fgcolor = Blitbuffer.COLOR_DARK_GRAY self.charlist = {} self.charpos = 1 else @@ -346,7 +346,7 @@ function InputText:initTextBox(text, char_added) bordersize = self.bordersize, padding = self.padding, margin = self.margin, - color = self.focused and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY, + color = self.focused and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY, self.text_widget, } self._verticalgroup = VerticalGroup:new{ @@ -387,7 +387,7 @@ end function InputText:unfocus() self.focused = false self.text_widget:unfocus() - self._frame_textwidget.color = Blitbuffer.COLOR_GREY + self._frame_textwidget.color = Blitbuffer.COLOR_DARK_GRAY end function InputText:focus() diff --git a/frontend/ui/widget/keyvaluepage.lua b/frontend/ui/widget/keyvaluepage.lua index 178624b44..e3ae7be2e 100644 --- a/frontend/ui/widget/keyvaluepage.lua +++ b/frontend/ui/widget/keyvaluepage.lua @@ -80,7 +80,7 @@ function KeyValueTitle:init() dimen = { w = self.width, h = Size.line.thick }, LineWidget:new{ dimen = Geom:new{ w = self.width, h = Size.line.thick }, - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, style = "solid", }, } @@ -94,7 +94,7 @@ function KeyValueTitle:init() overlap_offset = {0, -15}, TextWidget:new{ text = "", -- page count - fgcolor = Blitbuffer.COLOR_GREY, + fgcolor = Blitbuffer.COLOR_DARK_GRAY, face = Font:getFace("smallffont"), }, } @@ -486,7 +486,7 @@ function KeyValuePage:_populateItems() table.insert(self.main_content, VerticalSpan:new{ width = self.item_margin }) table.insert(self.main_content, LineWidget:new{ - background = Blitbuffer.COLOR_LIGHT_GREY, + background = Blitbuffer.COLOR_LIGHT_GRAY, dimen = Geom:new{ w = self.item_width, h = Size.line.thick diff --git a/frontend/ui/widget/linkbox.lua b/frontend/ui/widget/linkbox.lua index 4bb753f06..59f03bf65 100644 --- a/frontend/ui/widget/linkbox.lua +++ b/frontend/ui/widget/linkbox.lua @@ -9,7 +9,7 @@ local Screen = Device.screen local LinkBox = InputContainer:new{ box = nil, - color = Blitbuffer.COLOR_GREY, + color = Blitbuffer.COLOR_DARK_GRAY, radius = 0, bordersize = Size.line.medium, } diff --git a/frontend/ui/widget/listview.lua b/frontend/ui/widget/listview.lua index 3ea3ec961..a77b20846 100644 --- a/frontend/ui/widget/listview.lua +++ b/frontend/ui/widget/listview.lua @@ -22,7 +22,7 @@ Example: }, FrameContainer:new{ bordersize = 0, - background = Blitbuffer.COLOR_LIGHT_GREY, + background = Blitbuffer.COLOR_LIGHT_GRAY, TextWidget:new{ text = "bar", fact = Font:getFace("cfont"), diff --git a/frontend/ui/widget/menu.lua b/frontend/ui/widget/menu.lua index 9c31bf10a..d3bd23132 100644 --- a/frontend/ui/widget/menu.lua +++ b/frontend/ui/widget/menu.lua @@ -53,7 +53,7 @@ function ItemShortCutIcon:init() if self.style == "rounded_corner" then radius = math.floor(self.width/2) elseif self.style == "grey_square" then - background = Blitbuffer.gray(0.2) + background = Blitbuffer.COLOR_LIGHT_GRAY end --@TODO calculate font size by icon size 01.05 2012 (houqp) @@ -210,13 +210,13 @@ function MenuItem:init() text = self.text, face = self.face, bold = self.bold, - fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil, } mandatory_widget = TextWidget:new{ text = mandatory, face = self.info_face, bold = self.bold, - fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil, } else while true do @@ -228,7 +228,7 @@ function MenuItem:init() text = mandatory, face = Font:getFace(self.infont, self.infont_size), bold = self.bold, - fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil, } local height = mandatory_widget:getSize().h @@ -259,7 +259,7 @@ function MenuItem:init() width = self.content_width - mandatory_w - state_button_width - text_mandatory_padding, alignment = "left", bold = self.bold, - fgcolor = self.dim and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.dim and Blitbuffer.COLOR_DARK_GRAY or nil, } local height = item_name:getSize().h if height < max_item_height or flag_fit then -- we fit ! @@ -496,7 +496,7 @@ local Menu = FocusManager:new{ close_callback = nil, linesize = Size.line.medium, perpage = G_reader_settings:readSetting("items_per_page") or 14, - line_color = Blitbuffer.COLOR_GREY, + line_color = Blitbuffer.COLOR_DARK_GRAY, } function Menu:_recalculateDimen() diff --git a/frontend/ui/widget/networksetting.lua b/frontend/ui/widget/networksetting.lua index c289891d4..67cc908c7 100644 --- a/frontend/ui/widget/networksetting.lua +++ b/frontend/ui/widget/networksetting.lua @@ -83,11 +83,11 @@ function MinimalPaginator:paintTo(bb, x, y) -- paint background bb:paintRoundedRect(x, y, self.dimen.w, self.dimen.h, - Blitbuffer.COLOR_LIGHT_GREY) + Blitbuffer.COLOR_LIGHT_GRAY) -- paint percentage infill bb:paintRect(x, y, math.ceil(self.dimen.w*self.progress), self.dimen.h, - Blitbuffer.COLOR_GREY) + Blitbuffer.COLOR_DARK_GRAY) end function MinimalPaginator:setProgress(progress) self.progress = progress end @@ -380,7 +380,7 @@ function NetworkSetting:init() self.width = self.width or Screen:getWidth() - Screen:scaleBySize(50) self.width = math.min(self.width, Screen:scaleBySize(600)) - local gray_bg = Blitbuffer.gray(0.1) + local gray_bg = Blitbuffer.COLOR_GRAY_E local items = {} table.sort(self.network_list, function(l, r) return l.signal_quality > r.signal_quality end) diff --git a/frontend/ui/widget/openwithdialog.lua b/frontend/ui/widget/openwithdialog.lua index d5fc6e8c2..cfd93d5ae 100644 --- a/frontend/ui/widget/openwithdialog.lua +++ b/frontend/ui/widget/openwithdialog.lua @@ -113,7 +113,7 @@ function OpenWithDialog:init() h = Size.span.vertical_large*2, }, LineWidget:new{ - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, dimen = Geom:new{ w = self.width * 0.9, h = Size.line.medium, diff --git a/frontend/ui/widget/physicalkeyboard.lua b/frontend/ui/widget/physicalkeyboard.lua index 18f4f746f..a9b1459d7 100644 --- a/frontend/ui/widget/physicalkeyboard.lua +++ b/frontend/ui/widget/physicalkeyboard.lua @@ -52,7 +52,7 @@ function PhysicalNumericKey:init() VerticalGroup:new{ label_widget, TextWidget:new{ - fgcolor = Blitbuffer.COLOR_GREY, + fgcolor = Blitbuffer.COLOR_DARK_GRAY, text = self.physical_key_label, face = self.pkey_face, }, diff --git a/frontend/ui/widget/progresswidget.lua b/frontend/ui/widget/progresswidget.lua index 17f6322c2..c935492d4 100644 --- a/frontend/ui/widget/progresswidget.lua +++ b/frontend/ui/widget/progresswidget.lua @@ -41,7 +41,7 @@ local ProgressWidget = Widget:new{ bordersize = Screen:scaleBySize(1), bordercolor = Blitbuffer.COLOR_BLACK, bgcolor = Blitbuffer.COLOR_WHITE, - rectcolor = Blitbuffer.gray(0.7), + rectcolor = Blitbuffer.COLOR_DIM_GRAY, percentage = nil, ticks = nil, tick_width = Screen:scaleBySize(3), diff --git a/frontend/ui/widget/radiobuttontable.lua b/frontend/ui/widget/radiobuttontable.lua index 0c8b0f45a..e70e720b2 100644 --- a/frontend/ui/widget/radiobuttontable.lua +++ b/frontend/ui/widget/radiobuttontable.lua @@ -88,7 +88,7 @@ function RadioButtonTable:init() local button_dim = button:getSize() local vertical_sep = LineWidget:new{ - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, dimen = Geom:new{ w = self.sep_width, h = button_dim.h, @@ -129,7 +129,7 @@ function RadioButtonTable:addHorizontalSep(vspan_before, add_line, vspan_after, end if add_line then table.insert(self.container, LineWidget:new{ - background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY, + background = black_line and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY, dimen = Geom:new{ w = self.width, h = self.sep_width, diff --git a/frontend/ui/widget/textboxwidget.lua b/frontend/ui/widget/textboxwidget.lua index 38e166f4d..1deabb623 100644 --- a/frontend/ui/widget/textboxwidget.lua +++ b/frontend/ui/widget/textboxwidget.lua @@ -361,20 +361,7 @@ function TextBoxWidget:_renderText(start_row_idx, end_row_idx) if self._bb then self._bb:free() end local bbtype = nil if self.line_num_to_image and self.line_num_to_image[start_row_idx] then - -- Whether Screen:isColorEnabled or not, it's best to - -- always use BBRGB32 and alphablitFrom() for the best display of - -- various images: - -- With greyscale screen TYPE_BB8 (the default, and - -- what we would have chosen when not Screen:isColorEnabled): - -- alphablitFrom: some images are all white (ex: flags on Milan, - -- Ilkhanides on wiki.fr) - -- blitFrom: some images have a black background (ex: RDA, - -- Allemagne on wiki.fr) - -- With TYPE_BBRGB32: - -- blitFrom: some images have a black background (ex: RDA, - -- Allemagne on wiki.fr) - -- alphablitFrom: all these images looks good, with a white background - bbtype = Blitbuffer.TYPE_BBRGB32 + bbtype = Screen:isColorEnabled() and Blitbuffer.TYPE_BBRGB32 or Blitbuffer.TYPE_BB8 end self._bb = Blitbuffer.new(self.width, h, bbtype) self._bb:fill(Blitbuffer.COLOR_WHITE) @@ -441,14 +428,20 @@ function TextBoxWidget:_renderImage(start_row_idx) -- logger.dbg("display_bb:", display_bb, "display_alt", display_alt, "status_text:", status_text, "do_schedule_update:", do_schedule_update) -- Do what's been decided if display_bb then - self._bb:alphablitFrom(image.bb, self.width - image.width, 0) + -- With alpha-blending if the image contains an alpha channel + local bbtype = image.bb:getType() + if bbtype == Blitbuffer.TYPE_BB8A or bbtype == Blitbuffer.TYPE_BBRGB32 then + self._bb:alphablitFrom(image.bb, self.width - image.width, 0) + else + self._bb:blitFrom(image.bb, self.width - image.width, 0) + end end local status_height = 0 if status_text then local status_widget = TextWidget:new{ text = status_text, face = Font:getFace("cfont", 20), - fgcolor = Blitbuffer.COLOR_GREY, + fgcolor = Blitbuffer.COLOR_DARK_GRAY, bold = true, } status_height = status_widget:getSize().h diff --git a/frontend/ui/widget/textwidget.lua b/frontend/ui/widget/textwidget.lua index 9c35f75bc..0cc3b52a9 100644 --- a/frontend/ui/widget/textwidget.lua +++ b/frontend/ui/widget/textwidget.lua @@ -7,7 +7,7 @@ Example: text = "Make it so.", face = Font:getFace("cfont"), bold = true, - fgcolor = Blitbuffer.COLOR_GREY, + fgcolor = Blitbuffer.COLOR_DARK_GRAY, }) --]] diff --git a/frontend/ui/widget/toggleswitch.lua b/frontend/ui/widget/toggleswitch.lua index 573f1e70a..4eb73ce3b 100644 --- a/frontend/ui/widget/toggleswitch.lua +++ b/frontend/ui/widget/toggleswitch.lua @@ -36,7 +36,7 @@ local ToggleSwitch = InputContainer:new{ width = Screen:scaleBySize(216), height = Size.item.height_default, bgcolor = Blitbuffer.COLOR_WHITE, -- unfocused item color - fgcolor = Blitbuffer.COLOR_GREY, -- focused item color + fgcolor = Blitbuffer.COLOR_DARK_GRAY, -- focused item color font_face = "cfont", font_size = 16, enabled = true, @@ -50,7 +50,7 @@ function ToggleSwitch:init() self.toggle_frame = FrameContainer:new{ background = Blitbuffer.COLOR_WHITE, - color = Blitbuffer.COLOR_GREY, + color = Blitbuffer.COLOR_DARK_GRAY, radius = Size.radius.window, bordersize = Size.border.thin, padding = Size.padding.small, @@ -90,7 +90,7 @@ function ToggleSwitch:init() } local button = FrameContainer:new{ background = Blitbuffer.COLOR_WHITE, - color = Blitbuffer.COLOR_GREY, + color = Blitbuffer.COLOR_DARK_GRAY, margin = 0, radius = Size.radius.window, bordersize = item_border_size, diff --git a/frontend/ui/widget/touchmenu.lua b/frontend/ui/widget/touchmenu.lua index 45ebd6592..861daed70 100644 --- a/frontend/ui/widget/touchmenu.lua +++ b/frontend/ui/widget/touchmenu.lua @@ -102,7 +102,7 @@ function TouchMenuItem:init() }, TextWidget:new{ text = text, - fgcolor = item_enabled ~= false and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_GREY, + fgcolor = item_enabled ~= false and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY, face = self.face, }, }, @@ -510,7 +510,7 @@ function TouchMenu:init() -- pad with 10 pixel to align with the up arrow in footer HorizontalSpan:new{width = Size.span.horizontal_default}, LineWidget:new{ - background = Blitbuffer.gray(0.33), + background = Blitbuffer.COLOR_GRAY, dimen = Geom:new{ w = self.item_width - 2*Size.span.horizontal_default, h = Size.line.medium, diff --git a/plugins/coverbrowser.koplugin/listmenu.lua b/plugins/coverbrowser.koplugin/listmenu.lua index 62a73509e..863f02dfb 100644 --- a/plugins/coverbrowser.koplugin/listmenu.lua +++ b/plugins/coverbrowser.koplugin/listmenu.lua @@ -62,7 +62,7 @@ function ItemShortCutIcon:init() if self.style == "rounded_corner" then radius = math.floor(self.width/2) elseif self.style == "grey_square" then - background = Blitbuffer.gray(0.2) + background = Blitbuffer.COLOR_LIGHT_GRAY end local sc_face if self.key:len() > 1 then @@ -390,12 +390,12 @@ function ListMenuItem:update() local wfileinfo = TextWidget:new{ text = fileinfo_str, face = Font:getFace("cfont", 14), - fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil, } local wpageinfo = TextWidget:new{ text = pages_str, face = Font:getFace("cfont", 14), - fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil, } local wright_width = math.max(wfileinfo:getSize().w, wpageinfo:getSize().w) @@ -511,7 +511,7 @@ function ListMenuItem:update() width = wmain_width, alignment = "left", bold = true, - fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil, } local height = wtitle:getSize().h if authors then @@ -520,7 +520,7 @@ function ListMenuItem:update() face = Font:getFace(fontname_authors, fontsize_authors), width = wmain_width, alignment = "left", - fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil, } height = height + wauthors:getSize().h end @@ -614,7 +614,7 @@ function ListMenuItem:update() face = Font:getFace("cfont", 18), width = dimen.w - 2 * Screen:scaleBySize(10), alignment = "left", - fgcolor = self.file_deleted and Blitbuffer.COLOR_GREY or nil, + fgcolor = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil, } }, } @@ -790,7 +790,7 @@ function ListMenu:_updateItemsBuildUI() -- Build our list table.insert(self.item_group, LineWidget:new{ dimen = Geom:new{ w = self.width, h = Size.line.thin }, - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, style = "solid", }) local idx_offset = (self.page - 1) * self.perpage @@ -828,7 +828,7 @@ function ListMenu:_updateItemsBuildUI() table.insert(self.item_group, item_tmp) table.insert(self.item_group, LineWidget:new{ dimen = Geom:new{ w = self.width, h = Size.line.thin }, - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, style = "solid", }) diff --git a/plugins/coverbrowser.koplugin/mosaicmenu.lua b/plugins/coverbrowser.koplugin/mosaicmenu.lua index af48b5592..32b992b8b 100644 --- a/plugins/coverbrowser.koplugin/mosaicmenu.lua +++ b/plugins/coverbrowser.koplugin/mosaicmenu.lua @@ -60,7 +60,7 @@ function ItemShortCutIcon:init() if self.style == "rounded_corner" then radius = math.floor(self.width/2) elseif self.style == "grey_square" then - background = Blitbuffer.gray(0.2) + background = Blitbuffer.COLOR_LIGHT_GRAY end local sc_face if self.key:len() > 1 then @@ -261,7 +261,7 @@ function FakeCover:init() if self.file_deleted then self.dim = true - self.color = Blitbuffer.COLOR_GREY + self.color = Blitbuffer.COLOR_DARK_GRAY end -- As we are a FrameContainer, a border will be painted around self[1] @@ -494,7 +494,7 @@ function MosaicMenuItem:update() padding = 0, bordersize = border_size, dim = self.file_deleted, - color = self.file_deleted and Blitbuffer.COLOR_GREY or nil, + color = self.file_deleted and Blitbuffer.COLOR_DARK_GRAY or nil, image, } } diff --git a/plugins/goodreads.koplugin/doublekeyvaluepage.lua b/plugins/goodreads.koplugin/doublekeyvaluepage.lua index acd148ad4..e015321ef 100644 --- a/plugins/goodreads.koplugin/doublekeyvaluepage.lua +++ b/plugins/goodreads.koplugin/doublekeyvaluepage.lua @@ -62,7 +62,7 @@ function DoubleKeyValueTitle:init() dimen = { w = self.width, h = Screen:scaleBySize(2) }, LineWidget:new{ dimen = Geom:new{ w = self.width, h = Screen:scaleBySize(2) }, - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, style = "solid", }, } @@ -76,7 +76,7 @@ function DoubleKeyValueTitle:init() overlap_offset = {0, -15}, TextWidget:new{ text = "", -- page count - fgcolor = Blitbuffer.COLOR_GREY, + fgcolor = Blitbuffer.COLOR_DARK_GRAY, face = Font:getFace("smallffont"), }, } @@ -383,7 +383,7 @@ function DoubleKeyValuePage:_populateItems() local c = string.sub(entry, 1, 1) if c == "-" then table.insert(self.main_content, LineWidget:new{ - background = Blitbuffer.COLOR_LIGHT_GREY, + background = Blitbuffer.COLOR_LIGHT_GRAY, dimen = Geom:new{ w = self.item_width, h = Screen:scaleBySize(2) diff --git a/plugins/goodreads.koplugin/goodreadsbook.lua b/plugins/goodreads.koplugin/goodreadsbook.lua index f359df4a9..facc632af 100644 --- a/plugins/goodreads.koplugin/goodreadsbook.lua +++ b/plugins/goodreads.koplugin/goodreadsbook.lua @@ -65,14 +65,14 @@ function GoodreadsBook:genHeader(title) local header_title = TextWidget:new{ text = title, face = self.medium_font_face, - fgcolor = Blitbuffer.gray(0.4), + fgcolor = Blitbuffer.COLOR_WEB_GRAY, } local padding_span = HorizontalSpan:new{ width = self.padding} local line_width = (self.screen_width - header_title:getSize().w) / 2 - self.padding * 2 local line_container = LeftContainer:new{ dimen = Geom:new{ w = line_width, h = self.screen_height / 25 }, LineWidget:new{ - background = Blitbuffer.gray(0.2), + background = Blitbuffer.COLOR_LIGHT_GRAY, dimen = Geom:new{ w = line_width, h = Size.line.thick, diff --git a/plugins/statistics.koplugin/readerprogress.lua b/plugins/statistics.koplugin/readerprogress.lua index 95f02aad4..a92862379 100644 --- a/plugins/statistics.koplugin/readerprogress.lua +++ b/plugins/statistics.koplugin/readerprogress.lua @@ -22,8 +22,8 @@ local util = require("util") local _ = require("gettext") local Screen = Device.screen -local LINE_COLOR = Blitbuffer.gray(0.4) -local BG_COLOR = Blitbuffer.gray(0.2) +local LINE_COLOR = Blitbuffer.COLOR_WEB_GRAY +local BG_COLOR = Blitbuffer.COLOR_LIGHT_GRAY local ReaderProgress = InputContainer:new{ padding = Size.padding.fullscreen, diff --git a/resources/icons/dogear.png b/resources/icons/dogear.png index 33f4ac021..b725d4869 100644 Binary files a/resources/icons/dogear.png and b/resources/icons/dogear.png differ diff --git a/tools/wbuilder.lua b/tools/wbuilder.lua index 6f1422d76..c1cf80ac2 100755 --- a/tools/wbuilder.lua +++ b/tools/wbuilder.lua @@ -131,7 +131,7 @@ Background = InputContainer:new{ }, -- contains a gray rectangular desktop FrameContainer:new{ - background = Blitbuffer.COLOR_GREY, + background = Blitbuffer.COLOR_DARK_GRAY, bordersize = 0, dimen = Screen:getSize(), Widget:new{