Answers.Body: <p>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: <a href="https://i.sstatic.net/50XkG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/50XkG.png" alt="enter image description here"></a> </p>
  
  <p>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.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-10T02:19:33.850Z
Answers.Text: very interesting. I thought that KFX caused user controls to be disabled, but apparently not. Kindle needs better documentation!
Answers.UserDisplayName: idiotprogrammer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-11T04:46:29.143Z
Answers.Text: Yeah that's for sure!
Answers.UserDisplayName: b_q
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-09T04:14:02.700Z
Answers.LastActivityDate: 2018-09-09T04:14:02.700Z
Answers.UserDisplayName: b_q
Answers.Body: <p>To accomplish this, you would need to write a css media query supported in kindle which detects whether night mode is activated. </p>
  
  <p>Here's a <a href="https://www.mobileread.com/forums/showthread.php?t=274927" rel="nofollow noreferrer">two year old thread about the topic</a>. 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. </p>
  
  <p>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. </p>
  
  <p>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. </p>
  
  <p>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. </p>
  
  <p>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. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-08T02:11:53.113Z
Answers.LastActivityDate: 2018-09-08T10:21:44.127Z
Answers.LastEditDate: 2018-09-08T10:21:44.127Z
Answers.UserDisplayName: idiotprogrammer
Body: <p>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>
  
  <pre><code>p.red {color:#f00;}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-15T21:19:50.950Z
Comments.Text: maybe the last part of [this](https://askubuntu.com/a/1217391/925128) helps, including [this image](https://i.sstatic.net/RWTJ9.png)
Comments.UserDisplayName: cipricus
Tags: <kindle><epub><fonts><color>
Title: Maintain font color when changing background color in ebook
UserDisplayName: b_q
ThreadText: # Maintain font color when changing background color in ebook
  
  (Asked by: username_0 on 2018-09-06)
  
  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;}
  
  **Tags:** kindle, epub, fonts, color
  
  > **Comments:**
  > **username_1**: maybe the last part of [this](https://askubuntu.com/a/1217391/925128) helps, including [this image](https://i.sstatic.net/RWTJ9.png)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-09-09. Score: 2
  
  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](https://i.sstatic.net/50XkG.png)](https://i.sstatic.net/50XkG.png)
  
  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.
  
  > **Comments:**
  > **username_2**: very interesting. I thought that KFX caused user controls to be disabled, but apparently not. Kindle needs better documentation!  
  > **username_0**: Yeah that's for sure!  
  
  ---
  
  ### Answer by username_2 on 2018-09-08. Score: 1
  
  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](https://www.mobileread.com/forums/showthread.php?t=274927). 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.
  
  
  ---
  
  