![]() |
#1 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Feb 2025
Location: Somewhere on the eastern side of the land of the baguette
Device: Pocketbook Era
|
Having a SVG match the text color
Hello everyone,
Probably a noob question. Sorry about that. I am trying to create an epub from texts found on the internet, and some chapters feature a divider, which I reproduced as an svg. On Sigil, I can import it and use it as an image but here's the catch : I want to make it the same colour as the text (so that someone who would want to read with a different colour scheme can have a more consistent experience). I am aware I can use "fill:currentColor", but I can't get things to work how I want them to :
Here's the coding situation : ![]() This is quite infuriating and I'm out of ideas... Hence my question : do you know a way to import an svg that will keep the current Color attribute ? I feel like the <use> stuff could help but I must misundertand how the element works... Anyway, thanks in advance, and have a wonderful day ! ![]() EDIT : Huh. The imgur link doesn't display the image... Here's the link https://imgur.com/a/im-so-very-bad-epubing-ilVXkOG |
![]() |
![]() |
![]() |
#2 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,705
Karma: 103837201
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
imgur doesn't work on the forum and doesn't work for loads of users.
Also loads of sites block images not loaded directly, so the "Insert Image" icon tool isn't very useful. It should work for images on this site: ![]() Go Advanced and attach an image. There is a box Attach Files. Brings up a window to upload. After it's uploaded the Paper clip icon lets you insert it at current cursor position in the post. ^^ Here is an uploaded image and paper clip applied. EDIT Also imgur track people and object to safety script blocking. Their adverts could serve malware Last edited by Quoth; 02-20-2025 at 01:33 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Feb 2025
Location: Somewhere on the eastern side of the land of the baguette
Device: Pocketbook Era
|
Duly noted ! Thanks a lot !
So here's the picture of my being bad at epubing... You can see three attempts at displaying the svg divider :
EDIT Quote:
![]() |
|
![]() |
![]() |
![]() |
#4 | |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Feb 2025
Location: Somewhere on the eastern side of the land of the baguette
Device: Pocketbook Era
|
Duly noted ! Thanks a lot !
So here's the picture of my being bad at epubing... You can see three attempts at displaying the svg divider :
Quote:
![]() |
|
![]() |
![]() |
![]() |
#5 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
This was asked just a little bit ago. Check out this thread, post 8, for the solution. Basically you need to create a mask of the svg and set that color in the CSS. Cheers! |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Feb 2025
Location: Somewhere on the eastern side of the land of the baguette
Device: Pocketbook Era
|
Quote:
Thanks a lot. |
|
![]() |
![]() |
![]() |
#7 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
No worries - glad to help! Just remember to test any and all of this on your target device/app to make sure they play nice!
|
![]() |
![]() |
![]() |
#8 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,705
Karma: 103837201
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
|
![]() |
![]() |
![]() |
#9 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
Do you happen to know any devices/apps that this does NOT work?? If so, perhaps during your target device/app testing you find it doesn’t, you could simply use a @media query or a @supports check to provide a fallback… or JS if you are making ePub3 only. Cheers! |
|
![]() |
![]() |
![]() |
#10 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,705
Karma: 103837201
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
I use text.
|
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
You might even be able to use pseudo elements to automatically add them at the end of a chapter. Here's an example image from that post: |
|
![]() |
![]() |
![]() |
#12 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,142
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
If this is an eBook that's going to be for sale, you want it to be as backwards compatible with ePub2 as possible So don't use pseudo elements. If it's for you and you want ePub3, then have at it.
|
![]() |
![]() |
![]() |
#13 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I haven’t had any issues with pseudo-elements in ePub2. Most current devices/apps also don’t have a problem with them… and if your target market still supports old devices/apps then you should simply provide fallback coding:
Eg. -Here is the old coding -Here is the new coding If your device doesn’t support new coding it will automatically ignore it (per the spec) and revert to the old coding… |
![]() |
![]() |
![]() |
#14 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,142
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
A Kobo using RMSDK will not work with pseudo coding. So there you go. That's a very good reason not to use code that's not compatible but can use other code that is compatible. |
|
![]() |
![]() |
![]() |
#15 | ||
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
The pseudo-elements he was referring to were something like hr.ChDiv::after or h3::before.... IIRC these took a little longer to get widely adopted, but ::first-line and ::first-letter have been around forever. If kobo doesn't support them then kobo DRASTICALLY needs to update their software. Quote:
for example: The first paragraph supports pseudo elements. The second paragraph doesn't and simply falls back to the older styling. No spans were used in the making of this image...just a simple class (<p class="first">) and pseudo selectors. The paragraphs are otherwise identical. It's certainly not as pretty, but it is definitely readable. If the user doesn't like the basic look enough, then they can use a different/newer reader. IF the publisher INSISTS on a "one ePub to rule them all" then this is perfectly acceptable. IF, however, the professional publisher has a different css file for different markets/devices then Bob's your uncle (I miss Hitch!). You definitely are not required to limit yourself to ePub2 ONLY coding just to accomodate the outdated devices...there are many other options! |
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Tutorial] Convert TEXT to SVG IMAGE with Inkscape | GrannyGrump | Workshop | 13 | 04-29-2024 07:17 AM |
<svg><text> | Karellen | ePub | 4 | 07-03-2022 01:34 PM |
adding text after svg (not caption) on single page | dbb1480 | Sigil | 7 | 06-11-2016 05:00 AM |
Svg wrapper with a caption text field | roger64 | ePub | 13 | 01-31-2016 06:45 PM |
epub-kindle conversion blanks svg with text | bobb40 | Conversion | 2 | 09-28-2012 08:05 AM |