Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-14-2012, 12:55 PM   #1
LKJT
Junior Member
LKJT began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jul 2012
Device: none
Some letters unique color

Hey would it be possible to make every letter A blue and G red? I've tried doing this using the CSS stylesheet or whatever it is called. Unfortunately it doesn't work. Is it possible?

Maybe using some custom font where certain letters is of a certain color?

Thank you very much.
LKJT is offline   Reply With Quote
Old 07-14-2012, 01:11 PM   #2
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,802
Karma: 54830978
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 LKJT View Post
Hey would it be possible to make every letter A blue and G red? I've tried doing this using the CSS stylesheet or whatever it is called. Unfortunately it doesn't work. Is it possible?

Maybe using some custom font where certain letters is of a certain color?

Thank you very much.
(x)HTML time for you (best done in a code editor or Sigil)

CSS: .firstRed {font-color: red; } .firstBlue { font-color: blue; }

Now you modify the code
<p class="whatever"><span class="firstRed">G</span>o to the end</p>

<p class="whatever"><span class="firstBlue">A</span>nother example</p>
theducks is offline   Reply With Quote
Advert
Old 07-14-2012, 04:06 PM   #3
LKJT
Junior Member
LKJT began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jul 2012
Device: none
I'm sorry but I've no idea what you're trying to say.

I looked into Sigil and it seems like if I want the letters A and G to be of a certain color -
I'll have to edit every word in every book manually. Is that so?
LKJT is offline   Reply With Quote
Old 07-14-2012, 04:37 PM   #4
Serpentine
Evangelist
Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.Serpentine ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
Quote:
Originally Posted by LKJT View Post
I'll have to edit every word in every book manually. Is that so?
It's pretty easy with regex, however the flavour (PCRE) used in Sigil makes it a bit trickier than it needs to be

This is a simple way to do it - however PCRE doesn't allow this.
Code:
(?<=>[^<]*)(([dg])\2*)
About the best you will get is something like:
Code:
Find:
First run : (?<=>)([^<]*?)(([dg])\3*)
Run until 0 matches : (?<=>)([^<]+?)(([dg])\3*)

Replace:
\1<span class="red">\2</span>
You also need to avoid hitting things like the title tags. It would become pretty complex and useless at this point - as you're unlikely to use it.

In short - upload the book somewhere, then send me a link to it, I'll make the modification as needed. If you need to do this on multiple books, I'll write a little script to do it on epubs.

Last edited by Serpentine; 07-14-2012 at 04:42 PM.
Serpentine is offline   Reply With Quote
Old 07-14-2012, 06:15 PM   #5
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,802
Karma: 54830978
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 LKJT View Post
I'm sorry but I've no idea what you're trying to say.

I looked into Sigil and it seems like if I want the letters A and G to be of a certain color -
I'll have to edit every word in every book manually. Is that so?
Yes (Manual includes using REGEX as outlined by Serpentine).

While the methods suggested will work, You really need to understand what you are doing (CSS and HTML) before roaring off and doing cute tricks.
Start with some good basic textbooks or at www.w3schools
theducks is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unique characters used Toxaris ePub 17 03-19-2012 02:30 AM
Is Amazon unique jbcohen Reading Recommendations 2 05-11-2011 10:36 AM
Your Most Unique Bookmark? distant.star Lounge 12 09-12-2010 12:52 AM
Accessories Unique leather cases? 123YayKindle Amazon Kindle 1 08-17-2010 11:56 AM
hello, all the best for this unique community FiGi Introduce Yourself 4 04-03-2009 12:25 PM


All times are GMT -4. The time now is 07:17 PM.


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