gregorias / anki-code-highlighter

Anki plugin for code syntax highlighting.
GNU Affero General Public License v3.0
55 stars 3 forks source link

Changing syntax highlighting themes for the dark and light mode versions. #26

Closed NiamhFerns closed 1 year ago

NiamhFerns commented 1 year ago

Would it be possible to add an option (maybe in the config) to select the theme hljs uses for syntax highlighting?

My current understanding (forgive me if this is incorrect. I'm very much new to working with JS and webdev stuff) is that the colours for the highlighting as well as the background for the code blocks are takeng from _ch-hljs-solarized.css and _ch-pygments-solarized.css.

If this isn't a feature that'll be considered, is there someway I can manually change the theme that's being used myself? (I'm assuming I can just edit the .css files to use the correct colours or I can some how add a different .css file and direct the plugin to use that instead?)

gregorias commented 1 year ago

It is possible, and I'll think about it when I get back to this project some time soon.

Creating the theme file has been a semi-manual process, so there's probably no easy switch you can do yourself at this moment.

NiamhFerns commented 1 year ago

Yeah, there's no rush at all. Just thought it'd be a cool feature to have. I've found the correct theme files on the hjls github (I could only see the .min.css ones from the assets folder directly from the website) and I think I see how you've done it now.

Is it just the main.py that I have to change to point at a different theme file (_ch-hljs-\<theme>.css)? If so, I'm happy to chip away at making some alternate theme.css files that can be used (for hjls at least).

gregorias commented 1 year ago

In #27 I've added a config option to make style customization easier as well as instructions on how to add your styles. From what you told me, it should be enough for you, but let me know if you'd like more.

Thank you for offerring to work on additional styles, but I do not want to support them in my repo. Just have them for yourself or consider creating a separate plugin or a separate repository to maintain them.