Currently, markdown rendering and syntax highlighting are handled in the Rust backend. This might be a mistake, and potentially we should move this responsibility to the webview / Javascript.
The implementation "bakes" the color scheme directly into the generated HTML. The frontend, which caches this content, doesn't update the syntax highlighting color scheme when the main UI toggles between light and dark modes.
I think there's ~2 solutions:
Use classes for syntax highlighting elements, avoiding hardcoded color values. This way, CSS classes with variables can adjust to light/dark mode changes in the main UI.
Currently, markdown rendering and syntax highlighting are handled in the Rust backend. This might be a mistake, and potentially we should move this responsibility to the webview / Javascript.
Syntax highlighting leverages syntext, as detailed here: https://github.com/cablehead/stacks/blob/main/src-tauri/src/ui.rs#L304-L313
The implementation "bakes" the color scheme directly into the generated HTML. The frontend, which caches this content, doesn't update the syntax highlighting color scheme when the main UI toggles between light and dark modes.
I think there's ~2 solutions:
Possible approaches for this solution include:
syntect
to output classes instead of direct color values: https://docs.rs/syntect/latest/syntect/html/struct.ClassedHTMLGenerator.html