Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-13-2013, 11:13 AM   #1
Anak
Fanatic
Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.
 
Posts: 525
Karma: 483180
Join Date: Mar 2012
Location: DE
Device: Kobo Glo
How to mod the userStyle.css?

Based on this thread Where to put userStyle.css? (started by GeoffR). But as it is more of a dev/hack thing the question is better asked here. Applies to Touch, Glo and Mini.

Is there any way to modify the original userStyle.css? It is extracted to the device and placed in a unkown directory (at least for me as I don't have so much Linux skills) in the "hidden" system partition and therefore not directly accessable for more common users like me.
I would like to be able to modify the userStyle.css to tweak it to my personal preferences.

Some questions/ideas:
  • Can some one dump the orignial Kobo (RMSDK) userStyle.css. here?
  • Try to replace the orginal userStyle.css with an @import rule that refers to a editable user defined stylesheet that is placed somewhere else on the reader? Something like: @import {url("res:///userModStyle.css") all}, where "userModStyle.css" is actually placed in the root dirctory of the Kobo device. (Or use another file name and/or directory)

Quote:
Question:
How do I use the userStyle.css style sheet in order to change ePub properties?

Answer:
A good example to take a look at would be book2png. When the book2png sample is built, a folder named resources is created in its main directory. In there lies the userStyle.css file. The file is a regular style sheet file and can be modified in order to change the properties of the currently viewed ePub. The simplest way to try it out would be with the background-color:#b0c4de; property. This would change the background color to a light blue.

NOTE: for Android projects userSytle.css is located in project/assets/rmsdk/

[S-11411] (Source: Datalogics RMSDK)
Anak is offline   Reply With Quote
Old 04-13-2013, 03:47 PM   #2
xor_
Enthusiast
xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.xor_ can self-interpret dreams as they happen.
 
Posts: 47
Karma: 20894
Join Date: Nov 2012
Device: Nook ST, Kobo Glo
I don't think userStyle.css is an actual file in the file system.

If I run this on my device with a find binary from Debian, it doesn't find anything:

./find / -name userStyle.css
xor_ is offline   Reply With Quote
Old 04-13-2013, 06:35 PM   #3
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,907
Karma: 4329387
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
@Anak,

When I first got the Kobo Glo I tried the customised css technique which I know works on a Sony (unhacked, unrooted) device.

Based on the Kobo filenaming convention used for book cover images it looked as if the Kobo sees the int.memory root as file:///mnt/onboard (or maybe res:///mnt/onboard ???) in which case I thought adding
Code:
@import url(file:///mnt/onboard/my.css);
as the first line in each epub's internal css file might be a way to add my personal css (as contained in my.css file in Kobo root) to the existing css. Unfortunately I didn't have any success

The only way I've found, so far, to semi-automate what I wanted to do was to write homebrew code which cycled through
- explode epub
- add list of my css rules to css file
- rebuild epub
for each selected epub on the Kobo disk.

If the Kobo was my only ereader it's possible that I could have achieved the same result with a Calibre epub conversion using the ExtraCSS feature. However as my epubs need to be read by Kobo, Sony, PocketBook and Android, this wasn't workable for me.

If you have any bright ideas I will certainly be interested to hear them.
jackie_w is online now   Reply With Quote
Old 04-14-2013, 08:44 AM   #4
Anak
Fanatic
Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.Anak ought to be getting tired of karma fortunes by now.
 
Posts: 525
Karma: 483180
Join Date: Mar 2012
Location: DE
Device: Kobo Glo
@jackie_w,
Thanks for your clarifications on the userStyle.css.
Well, correct me if I'm wrong but there must be one file (or two one for kepub, one for epub) that hosts all supported css/html tags and defines all default settings.

Code:
@import url(file:///mnt/onboard/my.css);
Maybe it will work if you place your css in the fonts directory. This directory path is predefined by the system for locating external fonts.

Code:
@import url(file:///fonts/my.css");
Attached Files
File Type: pdf RMSDK_User_Manual.pdf (6.69 MB, 157 views)
Anak is offline   Reply With Quote
Old 04-15-2013, 12:15 PM   #5
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,907
Karma: 4329387
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
Quote:
Originally Posted by Anak View Post
Well, correct me if I'm wrong but there must be one file (or two one for kepub, one for epub) that hosts all supported css/html tags and defines all default settings.
Using info in the original thread referenced in the OP, I'm not sure whether userStyle.css actually exists as a permanent file or whether it's built on the fly as needed. I have no Linux skills but if you unzip a copy of your firmware update file and dig deep enough there is a file called libadobe.so (somewhere like KoboRoot/usr/local/Kobo/libadobe.so) If opened in a simple text editor, you can search for the string userStyle. There's only one hit (in fw 2.1.5) which is the path res:///userStyle.css. Just above this there is css code which looks like some default css created from parameters set in the Kobo user font settings screen.

I don't know whether someone who knows Linux might be able to SAFELY edit that adobe file before letting the update run. I do know that someone isn't me

I really don't know much at all about kepubs as I don't have any.

Quote:
Originally Posted by Anak View Post
Maybe it will work if you place your css in the fonts directory. This directory path is predefined by the system for locating external fonts.

Code:
@import url(file:///fonts/my.css");
Not for me. Again going back to the original thread referenced in the OP, in post #12 I documented that I found that if you want to reference sideloaded fonts directly from epub css then they are to be found in 4 subdirectories:
res:///fonts/normal/
res:///fonts/italic/
res:///fonts/bold/
res:///fonts/bolditalic/
not in res:///fonts or file:///mnt/onboard/fonts where you might have expected to be able to reference them. Based on tschering's disk file list (post #14), these 4 subdirectories do not appear to physically exist.

Unfortunately, I don't have the technical know-how to investigate further.

Edit: I see in the current fw version (v2.5.0), the file containing the default css is no longer libadobe.so (fw v2.1.5) but libnickel.so.1.0.0 in the same directory.

Last edited by jackie_w; 04-18-2013 at 03:24 PM. Reason: correction
jackie_w is online now   Reply With Quote
Old 04-25-2013, 09:32 PM   #6
theinfamousj
Zealot
theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.theinfamousj ought to be getting tired of karma fortunes by now.
 
theinfamousj's Avatar
 
Posts: 140
Karma: 2030000
Join Date: Dec 2011
Device: Kobo WiFi
For what it is worth, I have a Kobo WiFi and have userStyle.css as an actual file in it. It is located in the .kobo directory (which is hidden to those of us who have Linux, myself included), then the adobe directory, and then inside the pxf directory.

I'm including a screen shot of where I found it and what it looks like, as well as the file itself (unedited and as it comes) so that if anyone wants it for whatever reason and the newer firmware or Kobo builds come without it, they are now need fret no longer.
Attached Thumbnails
Click image for larger version

Name:	capture3631.png
Views:	101
Size:	12.2 KB
ID:	104973  
Attached Files
File Type: gz userStyle_css.tar.gz (164 Bytes, 70 views)
theinfamousj is online now   Reply With Quote
Old 04-26-2013, 05:06 AM   #7
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 1,418
Karma: 365040
Join Date: Jun 2012
Device: kobo touch
theinfamousj,
Thank you for uploading the file. Did you observe whether the content of this file changes every time you change the user settings? Did you try to edit the file?
tshering is offline   Reply With Quote
Old 04-26-2013, 08:55 AM   #8
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 2,907
Karma: 4329387
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O
@theinfamousj,

Thanks. I see a reference to res:///userStyle.css in the current firmware. If
Code:
res:///userStyle.css
is indeed equivalent to
Code:
/mnt/sdb/.kobo/adobe/pxf/userStyle.css
then I tried to reason that maybe one of
Code:
res:///../../../../../mnt/onboard/mycss.css
res:///../../../../onboard/mycss.css
might be used in a css @import rule to access my personal css, mycss.css in the Kobo internal memory. Alas, no

Thanks for trying to help. Any more bright ideas gratefully received
jackie_w is online now   Reply With Quote
Reply

Tags
css, hack

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to put userStyle.css? GeoffR Kobo Reader 15 04-06-2013 05:57 PM
Override ePub CSS with userStyle.css? barium Sony Reader Dev Corner 11 07-16-2011 04:25 PM
userstyle.css and epub margins tselling Sony Reader Dev Corner 8 10-28-2010 02:51 PM
ADE mit userstyle css mtravellerh PocketBook 0 05-21-2010 04:40 PM
user accessable userStyle.css please tselling PocketBook 9 05-19-2010 09:02 PM


All times are GMT -4. The time now is 06:34 AM.


MobileRead.com is a privately owned, operated and funded community.