code-syntax-addon / code-syntax

Syntax Highlighting Add-on for Google Apps
MIT License
16 stars 4 forks source link

Theme support #3

Closed devlato closed 4 months ago

devlato commented 2 years ago

Hi @floitsch!

Firstly, thanks a lot for building this amazing plugin! It's such a delight.

Just wanted to ask you if you would consider adding theme support? From the README, I can conclude that it's built on top of CodeMirror, which does support quite a few syntax highlighting themes – do you think it would be possible to support switching themes?

floitsch commented 2 years ago

Thanks.

Unfortunately there isn't a good way to use CodeMirror's themes. The add-on only uses the CodeMirror parser and then has to map the recognized styles to Google docs.

It currently does this in a hardcoded way: https://github.com/floitsch/syntax-addon/blob/master/theme/theme.ts#L159

The background colors are also hardcoded here: https://github.com/floitsch/syntax-addon/blob/master/theme/theme.ts#L100

Adding theme-support would therefore consist of two steps:

floitsch commented 4 months ago

Theme support has been committed and should (hopefully) be live soon.

The documentation is already published: https://code-syntax-addon.github.io/code-syntax/themes.html