kanji-colorize
kanji-colorize copied to clipboard
Add option to draw grid under characters
Hi! I tried to implement a feature that I think could be useful: an option to draw a grid under the character.
At first, I added the setting "grid" to the _parser
. The options are:
- "none": no grid (the default)
- "4": a 2x2 grid
- "8": a 4x4 grid
- "diag": a diagonal grid
- "diag4": a 2x2 grid with diagonals
- "diag8": a 4x4 grid with diagonals
I am not very creative: if you have better ideas for the names of the options let me know.
Then I added a function _add_grid
(only called if grid
is not "none") which adds to the svg a group <g id="kvg:grid" stroke="grey">
containing the needed paths in it. If you wish to change the id or the color, please let me know.
The tests I have written pass, and I modified the default_results
files to reflect the fact that the "grid" option is added to the svg copyright notice so that also previous tests are ok (except one that was also failing before the changes).
Finally, I have also added the option to the Anki add-on, defaulting to "none".
I have attached an example of the generated images. Let me know if you think I should add or change anything!
Thanks, this is really nice. I'll take a closer look when I have time.
I merged this on the cli.