krassowski / Anki-Night-Mode

Enabling studying at night with Anki - without eye strain
https://ankiweb.net/shared/info/1496166067
GNU General Public License v3.0
72 stars 13 forks source link

Apply color swappings to colors defined in template styling #52

Open salmivas opened 6 years ago

salmivas commented 6 years ago

Hello.

I'm trying to change a color on my card but nothing happens (color doesn't change). For example: image

I set colors by using css-styles. image

I've restarted Anki and even my laptop a couple of times but nothing changed. What I do wrong and how can I fix it. Is it a bug?

krassowski commented 6 years ago

Thank you for getting in touch. Please show HTML code of your card. You can do that my pressing ctrl + shift + x on the field of choice, or by selecting "Edit HTML" form hamburger menu on the right.

On Sun, 21 Oct 2018 at 11:47, Ivan Salmin notifications@github.com wrote:

Hello.

I'm trying to change a color on my card but nothing happens (color doesn't change). For example: [image: image] https://user-images.githubusercontent.com/35002517/47265823-ace24a00-d53e-11e8-9cff-4a7b2884d57c.png

I set colors by using css-styles. [image: image] https://user-images.githubusercontent.com/35002517/47265851-1c583980-d53f-11e8-8d49-26d94384bdb4.png

I've restarted Anki and even my laptop a couple of times but nothing changed. What I do wrong and how can I fix it. Is it a bug?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/krassowski/Anki-Night-Mode/issues/52, or mute the thread https://github.com/notifications/unsubscribe-auth/AFkAxjq_KuwpgxqhVFk97axG6WVtAdMjks5unFCpgaJpZM4XyZJf .

-- Best regards, Michał Krassowski

salmivas commented 6 years ago

Thank you for your quick reply. My card: image

Code of field "№": image

field "IMG": image

field "English": image

field "Keyword": image

field "Transcription": image

field "Russian": image

field "Sound": image

field "BrTranscription": image

field "AmTranscription": image

field "Am&BrTranscription": image

field "Extra": no code

field "Help": no code

krassowski commented 6 years ago

Thanks @salmivas. The color swapping feature was intended to modify colors introduced into the cards in the editor by clicking on "change text color" button. There is no easy technique to modify colors as defined by CSS styles without resorting to JS tricks. I will think about introducing such functionality into the add-on, however you can already accomplish desired result, simply adding a new CSS rule into styling of your template:

.night_mode .halfwidth {
    background: #b36b00
}

Please, see the picture below for reference: screenshot from 2018-10-21 14-08-55

salmivas commented 6 years ago

It works perfectly! Thanks so much @krassowski! Looking forward for the addon.

daviddavo commented 5 years ago

This doesn't work at all with the .card class. What if I want to change the background color of an entire card?