pigoz / anki-canvas

🖌️ Drawing area widget for Anki to practice Kanji writing
GNU Affero General Public License v3.0
38 stars 2 forks source link

Anki night mode - line color #5

Closed JhonnySalles closed 5 years ago

JhonnySalles commented 5 years ago

I use anki night mode often, is it possible to change the color of the line? because today the only method was to add panel in the exception, which makes the night mode useless

pigoz commented 5 years ago

Great idea! I will add support for it. Is that for AnkiDroid or on desktop Anki with https://github.com/krassowski/Anki-Night-Mode ?

I'm thinking about exposing a theming API to the options by adding a new colorScheme property which will accept the values: 'light' | 'dark' | 'auto'. The auto value will be the default and will automatically change the colors of the drawing area to the dark version when night mode is activated.

JhonnySalles commented 5 years ago

I use more on ankidroid, however it's a good idea to leave it for the anki pc. I use the extension on the computer too, however I did not even check to see if there is any difference, since my deck is configured to ignore the board

JhonnySalles commented 5 years ago

Thank you very much, because it is a very good resource that you have developed and it helps me a lot, because I do not like to activate the notes of the anki to write on the card, it hinders the scrolling of the screen.

JhonnySalles commented 5 years ago

If you want to add in your manual, I made a small change to make the frame size proportional to the screen. Because I use a tablet and a cell phone, it is disproportionate in one of them. Here's the code: Add in front and back:

I only noticed that it was disproportionate in the computer, however in this case I believe that it would solve to obtain the size of the div. But on tests I performed on my cell phone, I often ignored the size of the div for some reason I did not delve into searching.

pigoz commented 5 years ago

@JhonnySalles Could you try this? It's a test version with night mode support. I've only tested in AnkiDroid.

漢字.apkg.zip

JhonnySalles commented 5 years ago

Of course, I will do the tests and I will inform you

JhonnySalles commented 5 years ago

I did some tests, in the computer the addon night mode ends up ignoring the frame and does not perform the automatic inversion like the anki droid:

Sem tĂ­tulo

Taking the test on the ankidroid did not find any difference, because the line still remains in black color. Has a new variable been added to the line color? Checking the deck that was shared I found no such variable. 2019_05_13_12 13 00 2019_05_13_12 13 07

The values ​​that were previously stated "'light' | 'dark' | 'auto'" should be added next to the size values?

pigoz commented 5 years ago

Thank you for testing. Which Anki plugin are you using for night mode?

As for AnkiDroid the behaviour is quite strange: is your config like this?

<script>
window.AnkiCanvasOptions = {
  frontCanvasSize: 300,
  frontLineWidth: 7,
  backCanvasSize: 150,
  backLineWidth: 3.5,
  colorScheme: 'auto',
}
</script>
JhonnySalles commented 5 years ago

This pluging https://ankiweb.net/shared/info/1496166067

It's the same as you mentioned earlier.

JhonnySalles commented 5 years ago

It was missing the (colorScheme: 'auto',), but even adding nothing happened, the line is still black in front card.

I'll try to use a new user and get the _front.js script again

pigoz commented 5 years ago

Please, try to test this in isolation. Create a new user, and double click the deck I linked (_front.js is no longer needed since I found a way to embed the JavaScript directly in the card layout in version 0.4)

JhonnySalles commented 5 years ago

I actually tested it on a new user functioned. I do not know why, but I believe the anki is not overwriting the last type of card. When copying the code all the same worked perfectly and came with the new variable.

2019_05_13_13 02 12

As for pc anki, I noticed a strange thing when performing the copy. I noticed that the card in edition gets to be black, but after saving it back to normal.

Sem tĂ­tulo2 Sem tĂ­tulo3

Maybe it could be some rendering that the pc anki does differently, or else what turned black was your code at that time.

When saving the card, the ankidroid works normally, but on the pc it goes white again.

JhonnySalles commented 5 years ago

Thanks for all the effort, I believe that many others can enjoy this new update without burning their eyes at night kkkk

Perhaps an interesting point, if you like, could make the field colorScheme: 'auto' receive a hexadecial color, so you can have a greater customization in the trace. Just a tip.

Thank you so much for all the work.

pigoz commented 5 years ago

Sorry for the late reply. I suspect setting colorScheme to 'dark' in the AnkiOptions section of the card will solve the problem with desktop Anki.

As for hex customization, it's something I'm considering. But I'd like the user to be able to customize both light and dark mode, or even add user defined modes so that they can force some colors only on certain platforms.

JhonnySalles commented 5 years ago

oh yes, I understood.

pigoz commented 5 years ago

I published a new release: https://github.com/pigoz/anki-canvas/releases/tag/v0.5

Everything should be taken care of. Compared to what you tested, it's now possible to choose your own color, and I fixed the automatic color scheme selection when using desktop Anki.

JhonnySalles commented 5 years ago

wow, thx verry much.