The chapter headings and some specific lines in the book are red font, which shows up fine in normal (white background) reading mode. But when toggling the kindle/e-reader to black or sepia background, the red font changes to white/brown along with the rest of the text. Any way to avoid this and maintain the red font regardless of the background? I'm using a very simple css for it:

p.red {color:#f00;}

Amazon may have resolved this for us, or it's just one of those things that worked itself out. I haven't changed the CSS at all after posting the question, but I DID convert the book to KFX format using the plugin for Calibre, and the renamed the KFX file with a .mobi extension, opened it in Kindle for Mac, and viola the colors are sticking: enter image description here

What you're seeing here is red font displayed in "night mode" - so I don't know if it's a factor of the "basic" mobi format (which would have changed this to white text) versus the KFX format (which is what Amazon delivers to a buyer through the Kindle store), but I would presume that this would be preserved through the KDP publishing process. Never a guarantee though.

PS sorry, I don't have time tonight to post how I went through the above process, but I can if someone needs it and leaves a comment.

  • very interesting. I thought that KFX caused user controls to be disabled, but apparently not. Kindle needs better documentation! – idiotprogrammer Sep 10 at 2:19
  • Yeah that's for sure! – b_q Sep 11 at 4:46

To accomplish this, you would need to write a css media query supported in kindle which detects whether night mode is activated.

Here's a two year old thread about the topic. Not very useful, btw, and they go off on a tangent. They offer advice about how to create css media queries to target specific devices. This is not a good strategy for dealing with the issue.

You should download the latest Amazon Publishing Guidelines and maybe ask on the KDF technical formatting forum whether someone had stumbled upon a solution. I just looked there and found nothing.

In web browsers, you can make a css media query to detect night mode by matching color; ie, if color=black, then use this css color, etc. But that wouldn't work on a specific platform like Kindle, I'm guessing.

The thinking behind night mode is to provide complimentary colors. Its algorithm for determining what is complimentary is not documented yet, nor do I know a css media query for Kindle which you can use. It would require a good amount of testing to figure it out on your own, I'm guessing.

At the moment, I don't see an easy way to accomplish what you want -- though there probably is a need. That said, I do generally trust the algorithms in night mode which try to maximize contrast.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.