From 384542e0304660a71b3a018c4d359ddb777b0d3c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 28 Sep 2014 11:37:13 +0530 Subject: [PATCH] E-book viewer: Fix a regression, caused by a Qt 5 behavior change, that caused incorrect colors to be shown when viewing MOBI files that use CSS 3 color specifications internally. --- src/calibre/ebooks/mobi/reader/mobi6.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/ebooks/mobi/reader/mobi6.py b/src/calibre/ebooks/mobi/reader/mobi6.py index 207303dfcd..9c9ffe1d3a 100644 --- a/src/calibre/ebooks/mobi/reader/mobi6.py +++ b/src/calibre/ebooks/mobi/reader/mobi6.py @@ -513,6 +513,11 @@ class MobiReader(object): 'div' and 'filepos-id' in attrib): pagebreak_anchors.append(tag) + if 'color' in attrib: + styles.append('color: ' + attrib.pop('color')) + if 'bgcolor' in attrib: + styles.append('background-color: ' + attrib.pop('bgcolor')) + if 'filepos-id' in attrib: attrib['id'] = attrib.pop('filepos-id') if 'name' in attrib and attrib['name'] != attrib['id']: