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

Go Back   MobileRead Forums > E-Book Software > Calibre > Viewer

Notices

Reply
 
Thread Tools Search this Thread
Old 11-14-2012, 09:40 AM   #151
cyberxaos
Junior Member
cyberxaos began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Nov 2012
Device: iPhone
Here's an "iBook" theme I created for my 13" Macbook Pro (1280 x 800) display:

http://pastebin.com/tUxfe8cL#

Should be able to just cut 'n' paste this -- it has a base64 encoded png of a "book" as the image-background. Works well in full screen mode on my 1280x800 display -- probably won't work on other display sizes. Thanks to the base64 encoding there's a lot of css text, so it may take a minute to load into your "user stylesheet" tab (be prepared for spinning rainbow wheel).

Mac users: if you want to craft your own, use following css along with the background image of your choice (put the image in /Users/<your username>/Library/Preferences/calibre/images):

body {color:rgb(80,58,34);
background-color:rgb(174,174,174);
background-image:url("/Users/<your username>/Library/Preferences/calibre/images/<filename>.png");
background-repeat:no-repeat;
background-attachment:fixed;
background-position:center;
text-align:justify;
line-spacing:1.8;
margin-top:50px;
margin-bottom:50px;
margin-right:50px;
margin-left:50px;
text-indent:3em;}
h1, h2, h3, h4, h5, h6
{color:rgb(80,58,34);
text-align:center;
font-style:italic;
font-weight:bold;}
cyberxaos is offline   Reply With Quote
Old 12-06-2012, 07:07 AM   #152
ms_ts_2007
Junior Member
ms_ts_2007 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2012
Device: Pc
Quote:
Originally Posted by rgponce View Post
My style sheet:

body {
color: #393939;
background:#F9F0C9 url('file:///C:/Program Files (x86)/Calibre2/resources/images/old_paper.jpg');
text-align:justify;
line-spacing:1.8;
margin-right:8em !important;
margin-left:8em !important;
}
p {
text-indent:2.5em !important;
padding-bottom:0.5em;
font-family: "Book Antiqua", Palatino, serif !important;
}
h1, h2, h3, h4, h5, h6, .p6 {
color: #330000 !important;
border-bottom: 2px solid #330000 !important;
text-align:right !important;
font-style:italic !important;
font-weight:bold !important;
font-size: 1.3em !important;
}
::selection {
background: #FADC5C;
}

image used as background:
Alright, this is exactly what I was looking for, a way to set a background image to my viewer. Now please, can someone please help me make a stlysheet that will leave every other setting intact, just adding the background image feature ?

Or point me how i can do this via Calibre interface, in case i am blind and I've missed it.
ms_ts_2007 is offline   Reply With Quote
Advert
Old 12-29-2012, 07:10 PM   #153
maisondouf
Junior Member
maisondouf began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2012
Device: Sony
Please, how to make margin-bottom and margin-top working ??
maisondouf is offline   Reply With Quote
Old 12-29-2012, 08:07 PM   #154
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by maisondouf View Post
Please, how to make margin-bottom and margin-top working ??
Toggle the scroll icon to enter Paged mode. Now you will get a top and bottom margin that you can easily control via viewer preferences.
DoctorOhh is offline   Reply With Quote
Old 12-30-2012, 06:09 AM   #155
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
Ms_ts_2007,

I believe just the following should do what you want:

body {
background:#F9F0C9 url('file:///C:/Program Files (x86)/Calibre2/resources/images/old_paper.jpg');
}

If the book you load includes it's own background color (the #F.. portion) and image (the url portion) it might override the info above. Adding " !important" (including space but without quotes) after the closing parenthesis and before the semi-colon might correct this issue. (I've never used an image. It will definitely override the color.)


CSS, kind of like missing ebook metadata, doesn't complain if various bits and pieces are not present. CSS just assumes that the defaults apply and only the mentioned bits are being changed.

The body section affects the page itself; the p is for defining paragraphs, the h1-p6 are various heading definitions. The selection... is beyond my knowledge.

Last edited by Sabardeyn; 12-30-2012 at 06:15 AM.
Sabardeyn is offline   Reply With Quote
Advert
Old 12-30-2012, 11:05 AM   #156
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Sabardeyn View Post
Ms_ts_2007,

I believe just the following should do what you want:

body {
background:#F9F0C9 url('file:///C:/Program Files (x86)/Calibre2/resources/images/old_paper.jpg');
}

That path is to the Calibre install folder (which varies by OS) (as do the direction of the \'s )

It would be better to place a COPY of that file into the resources\images of the configuration folder

BTW 'old_paper.jpg' does not exist in my (default, calibre) install

Last edited by theducks; 12-30-2012 at 11:06 AM. Reason: configuration folder
theducks is offline   Reply With Quote
Old 12-30-2012, 07:03 PM   #157
Sabardeyn
Guru
Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.Sabardeyn ought to be getting tired of karma fortunes by now.
 
Sabardeyn's Avatar
 
Posts: 644
Karma: 1242364
Join Date: May 2009
Location: The Right Coast
Device: PC (Calibre), Nexus 7 2013 (Moon+ Pro), HTC HD2/Leo (Freda)
Thanks for the clarification, I'm sure it will be of help to users of other OSes.

The info posted was from Cyberxaos' post originally. I just excised the applicable example and did the "CSS to English" translation.

The original post has a link that includes the image, I think. Never used pastebin so I'm not sure how they've implemented things - it appears to be a hex dump of an image file.
Sabardeyn is offline   Reply With Quote
Old 01-05-2013, 10:57 AM   #158
maisondouf
Junior Member
maisondouf began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2012
Device: Sony
Quote:
Originally Posted by DoctorOhh View Post
Toggle the scroll icon to enter Paged mode. Now you will get a top and bottom margin that you can easily control via viewer preferences.
Ok, but in eBook viewer's prefrences, I don't find any option for that...

even so thanks for your answer.

EDIT: I would be better to apply 'user stylesheet' to a div cantaining all the page instead of body.
The scenario for displaying text would be the same, but we can apply a margin before displaying this div in the body.
But perhaps, it's not possible...

Last edited by maisondouf; 01-05-2013 at 11:20 AM.
maisondouf is offline   Reply With Quote
Old 01-05-2013, 11:58 AM   #159
maisondouf
Junior Member
maisondouf began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Dec 2012
Device: Sony
Youpi, I found a better solution...
Uninstall Ubuntu version (0.8.38) ande install last stable (0.9.13).
Now margin options are available.
maisondouf is offline   Reply With Quote
Old 01-06-2013, 02:04 AM   #160
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by maisondouf View Post
Youpi, I found a better solution...
Uninstall Ubuntu version (0.8.38) ande install last stable (0.9.13).
Now margin options are available.
Glad you figured it out. Not a better solution, the same solution. The reason you couldn't find the option is that it didn't exist until 0.8.61.

From What's New:

Quote:
Release: 0.8.61 [20 Jul, 2012]

New Features
  • E-book viewer: Add a paged mode that splits up the text into pages, like in a paper book instead of presenting it as a single column. To activate click the button with the yellow scroll icon in the top right corner.

    In paged mode, the ebook viewer no longer cuts off the last line of text at the bottom of the screen, and it respects CSS page-break directives. You can also set page margins and control the number of pages displayed on screen by clicking the Preferences button in the viewer and going to 'Text layout in paged mode'.
DoctorOhh is offline   Reply With Quote
Old 01-11-2013, 03:56 PM   #161
KeithJ108
Junior Member
KeithJ108 began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jan 2013
Device: Kindle Keyboard
Background color ignored?

Hi,

I created a user CSS template from some of the examples here but it seems that the background color is ignored by the Calibre eBook viewer. I can change the color in the eBook viewer preferences window but not through the CSS style-sheet.

Is this a bug or is there something wrong with my code?
Calibre version 0.9.14 on Windows 8 64-bit.

Code:
h1, h2, h3, h4, h5, h6 {
	font-weight: bolder;
	text-transform: capitalize;
	color: rgb(0, 0, 0);
	text-align:center;

}
body {
	color: rgb(0, 0, 0);
	background-color: rgb(254, 243, 213);
	text-align: justify;
	line-spacing: 1.8;
	margin-top: 0px;
	margin-bottom: 4px;
	margin-right: 50px;
	margin-left: 50px;
	text-indent: 3em;
}
KeithJ108 is offline   Reply With Quote
Old 01-11-2013, 10:52 PM   #162
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,744
Karma: 22446736
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You need to use !important to ensure you override whatever color is set in the books code.
kovidgoyal is offline   Reply With Quote
Old 01-17-2013, 04:10 PM   #163
orrajabi
Junior Member
orrajabi began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jan 2013
Device: samsung GT-P5100
Dear all,
I am a new user and don't know much about CSS.
I am using Persian language. It is from right to left. How can I tell Calibre through CSS to change the text-direction to "right-to-left"?

Thanks in advance.
orrajabi is offline   Reply With Quote
Old 01-23-2013, 04:38 PM   #164
Vortex
Groupie
Vortex began at the beginning.
 
Vortex's Avatar
 
Posts: 171
Karma: 10
Join Date: Dec 2008
Device: Likebook Mars
I'm trying to use this background image how do I stop it from being tiled so it fits the Calibre reader? I'm attempting to create something similar to what I have set up in ubook.
Thanks.

Last edited by Vortex; 01-23-2013 at 04:46 PM.
Vortex is offline   Reply With Quote
Old 01-23-2013, 06:50 PM   #165
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Vortex View Post
I'm trying to use this background image how do I stop it from being tiled so it fits the Calibre reader? I'm attempting to create something similar to what I have set up in ubook.
Thanks.
I only know how to do it editing the stylesheet
Code:
background-repeat: no-repeat;
theducks is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom CSS for output deckoff Calibre 1 08-28-2010 11:55 PM
ePub with custom .css on a 505 dicknskip Sony Reader Dev Corner 3 06-09-2010 11:34 PM
User stylesheets for ePub files salty-horse Sony Reader Dev Corner 12 02-23-2010 07:44 AM
ePub conversion: override existing css with a custom one sbin Calibre 1 01-09-2010 04:03 AM
Calibre's generated css for epub brewt Calibre 7 12-29-2008 09:59 AM


All times are GMT -4. The time now is 12:18 AM.


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