View Full Version : Sidebar background color in ePub


AshleyLynn
04-22-2013, 12:01 PM
Hello everybody.
I'm new to this forum and haven't quite worked out how to use it yet, so please forgive me if I'm posting this in the incorrect place.
I'm also very new to ePub, so if this is a horribly simple question please be kind.

Is there a way to give a background color to a paragraph of text?

Imagine you're working in an html file and you have a <div> filled with text. You can set a background color in the CSS. Is this possible to do for an ePub, perhaps using the "Tweak" function in Calibre?

Thank you for your time,
Ashley

Ken Maltby
04-22-2013, 12:27 PM
The issue you might run into is the difference between what you can have in a browser
and what an ereading device's rendering software can implement. It will be interesting
to see what this thread generates.

Luck;
Ken

Tex2002ans
04-22-2013, 04:30 PM
Is there a way to give a background color to a paragraph of text?

You would use the background-color CSS attribute: http://www.w3schools.com/cssref/pr_background-color.asp

I just posted a sample of this a few days ago as a side point in my thread. Here is a direct link to the post (with an image of how it appears, and the div CSS that I use):

http://www.mobileread.com/forums/showpost.php?p=2484725&postcount=9

Also, keep in mind what colors you choose for the background, certain colors on e-ink devices will lead to unreadable text.

mrmikel
04-22-2013, 07:33 PM
There is no easy way to be sure which colors will be affected, either. I had a cover with bright orange letters which disappeared when it was converted to grayscale. No amount of fiddling in a graphics program would fix it either.

Aerys
04-23-2013, 06:42 AM
Also take note that using background colors sometimes doesn't render nicely when "NIGHT MODE" is used on the tablet.

JSWolf
04-27-2013, 09:45 PM
Also take note that using background colors sometimes doesn't render nicely when "NIGHT MODE" is used on the tablet.

Not only that, but they can be distracting in any reading mode.

dgatwood
05-01-2013, 01:05 AM
As an exception, one common use for background color is to create a small area of white-on-black text, e.g. in a heading. That usually works fine in night mode, though the background disappears into the page. Using white-on-dark-grey can mitigate this somewhat.

Jellby
05-02-2013, 08:57 AM
ePub is supposed to support alternate stylesheets, which means you could have a CSS style for "day mode" and a different one for "night mode" (ePub 3 even specifically uses these names). I know of no reader that actually supports this, though.