![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
CSS styles modifications inside nickel
This is a tool writen in python that allows to change all css styles located inside nickel file. There are two scripts, one to extract and one to patch.
- First step is to run python extract.py to get all css found in nickel. - For each css stream a .css file is created (45 .css files for firmware 3.19.5761). - Browse .css files to find out interesting things that could be changed. - Modify .css files and run python patch.py to put them inside nickel. Notes: - Extracted .css files are easy to view and modify with any text/css editor. - Css code inside nickel is detected on compressed and non-compressed streams. (24 and 21 for fw 3.19.5761) - When you modify a .css file your code cannot be longer than original code. To allow some extra chars to add some css properties or change a font name, etc, if your code is longer it will be minified. That gives you additional characters, the number depends of css code (if longer and with comments, more to gain). - When running patch.py if your code is too long an error message will be show, and you need to shorten maybe removing code related to other devices. --------------------- New improved version v04: https://www.mobileread.com/forums/sho...2&postcount=22 Last edited by pipcat; 06-07-2016 at 05:17 PM. Reason: Link to new version v04 |
![]() |
![]() |
![]() |
#2 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
Info about extracted streams in firmware 3.19.5761:
- zlib-18.css : the longer css (41,7 kb). (entities) - zlib-19.css : (generic classes) - zlib-20.css : font sizes only for qApp_deviceIsAlyssum (Glo Hd). - zlib-24.css : (smaller other recent book tiles, SmallRecentBookTile) - zlib-26.css : related to Beta features (to enable/disable games). - zlib-36.css : (biggest most recent book tile, RecentBookTile) - ... - nozlib-5.css : #InlineDictionaryView - ... Last edited by pipcat; 06-03-2016 at 02:53 AM. Reason: Added info from jackie_w |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,310
Karma: 169098402
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Well this is an ambitious little project!
![]() For anyone interested, I was able to slightly increase the size of the Home screen Recent Book cover thumbnails by editing
|
![]() |
![]() |
![]() |
#5 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
Thx jackie_w ;-) Could you post or send me your changes in zlib-24/36 to include them in modified-samples folder ?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Quote:
I can't easily test this but you can probably also apply the same coverBorder tweak to:
BTW Several firmwares ago, this coverBorder tweak used to be one of GeoffR's/Metazoa patches until the code 'disappeared' from libnickel.so.1.0.0. Now, at last, we know where it went, so thanks for digging it up again ![]() |
|
![]() |
![]() |
![]() |
#7 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
In a similar way than with nickel, I wrote a script to extract css streams from libnickel, libadobe, etc. I attach script and extracted .css files. Because there are many streams in libnickel, there is no one .css file for each one but one for file with all streams. For instance there is no python patch, but they can be done with metazoa pack. The goal is to have a look to all css styles together. There are still some other css in utf-16 strings that are not detected with this script.
Extraction for firmware 3.19.5761: 634 css streams in libnickel.so.1.0.0 0 css streams in librmsdk.so.1.0.0 1 css streams in libadobe.so 21 css streams in libsudoku.so 3 css streams in librushhour.so |
![]() |
![]() |
![]() |
#8 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
Updated extractor and patcher for nickel css streams.
Now, all css streams are in one single file, simpler to manage. A Kobo Glo Hd device accomplish condition IsAlyssum and also IsDragon. Do you know wich conditions are done on other devices? You can test it with attached patcher... Readme: Spoiler:
Last edited by pipcat; 06-05-2016 at 02:37 PM. Reason: Updated zip to correct a bug when minifying inside zlib! |
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
@pipcat,
Thanks for your continued investigations. Although modifying nickel this way is probably not for the technically faint-hearted the biggest problem will be that most Windows users will not have Python installed on their PC and so will not be able to run extract.py or patch.py. What they may not know is that if they do have calibre installed on the PC, it's possible to use the Python bundled inside calibre to run .py files. This is a simple Windows .bat file to run extract.py via calibre's Python. It should be placed in the same directory as extract.py: Code:
echo off
set STARTDIR=%~dp0
calibre-debug "%STARTDIR%extract.py"
PAUSE
|
![]() |
![]() |
![]() |
#10 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
Interesting tip for windows users with Calibre, thx.
"technically faint-hearted"... I didn't know this expression, it's funny ;-) I understand that no all windows users wants to install python, but executing a python script and edit a css file is not a high technical requirement. Ok, it's not for everybody, but it's not so difficult, at least for a developer's corner ;-D And is it not easier to edit a css file (normally nice colored by editors) than to edit a typical patch file ? |
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
A lot of users will be a bit hesitant when it comes to things like .bat, commandline and running scripts. But, yes, all degrees of difficulty are OK in a Developers Corner.
Editing CSS files is not particularly difficult but understanding exactly what each of those widgets and CSS streams do is not yet fully understood - at least by me. So editing something can be a bit try-it-and-hope-for-the-best. Please don't think I'm trying to criticise because I don't mean to ![]() BTW, I discovered the widget called #bookCoverListTile in nickel, is the Homescreen tile labeled 'Library' for newly added books (shows one full & two partial cover thumbnails). I'm not sure there's any great point in tweaking it but I'm just sharing that it's possible. |
![]() |
![]() |
![]() |
#12 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
Hi jackie_w, I didn't think you criticise ;-) I really appreciate your comments very much! I'm sorry because I can't explain myself very well in english, and I can't express my feelings correctly ;-( Forums like this are good places to discuss/debate, that's nice!
Personally, I'm more hesitant to execute an .exe file without having its source code than to run a python script. And I agree with you that the difficulty of css is to understand where and when they are used, and we need to try-and-hope. But that's also the same (and really worst) when looking around disassembled code. Anyway, this tool helps to investigate and try css customizations, at least for non-faint-hearted ;-). If some css changes are useful they can be packed for everybody in bad-eyes pack for example. Let's continue to find interesting things in css: - When I removed coverBorder (setting to 0) for SmallRecentBookTile and #RecentBookTile I missed another coverBorder to remove it from 'Library'. With your tip for #bookCoverListTile I found it. In this case there is no coverBorder and adding it does nothing, but setting qproperty-itemPadding to 0 (instead of 6) removes the borders. (located in /* found: 15 (zlib) pos: 4a17bd */) |
![]() |
![]() |
![]() |
#13 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
|
|
![]() |
![]() |
![]() |
#14 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
Quote:
Two questions about your patchit.exe : Is it ok if newpart is shorter than oldpart ? (if you change four byte size value when non-compressed values, it should be ok). If there are 5 oldpart in a patch, is it ok if only 3 newpart ? (or we need 5 newpart lines, last two emptys ?) |
|
![]() |
![]() |
![]() |
#15 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 65
Karma: 200153
Join Date: Apr 2016
Device: Kobo Glo Hd
|
Updated patch-nickel-css scripts, with an option to generate bad-eyes format. Instead of executing python patch.py we can run python patch_badeyes.py and get a .txt with our customizations for bad-eyes pack.
Tshering, these are two examples, zlib and not, with myglohd.css modifications. newpart are some lines shorter than oldpart. Is that ok for patchit.exe ? Spoiler:
Spoiler:
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Check non existent css styles | Terisa de morgan | Editor | 15 | 06-15-2014 10:24 AM |
Modding Calibre CSS styles | Olger | Recipes | 7 | 01-25-2012 05:08 AM |
CSS Table Styles: Does it work? | Alan Newson | ePub | 3 | 12-12-2011 03:54 PM |
Tool to centralise css styles? | snarkophilus | ePub | 7 | 07-01-2011 04:08 AM |
Sigil styles and CSS | View[+]Finder | Sigil | 4 | 05-27-2010 05:39 PM |