r3bl-org/r3bl-open-core

r3bl_ansi_color - add support for syntect output

Closed this issue · 2 comments

Context:

Provide a syntect theme & make it easy to take output from syntect and use this crate to colorize it before it is printed to the terminal

Functionality to do this already exists int he r3bl_tui crate here https://github.com/r3bl-org/r3bl_rs_utils/blob/main/tui/src/tui/syntax_highlighting/r3bl_syntect_theme.rs#L1

Hey @nazmulidris , I would like to try this, but not exactly sure where to start. So I want to know where exactly would the syntect fit in?. I mean like does it go as a variable to the struct AnsiStyledText(like modify the struct to also take in a theme?) ? And we highlight the text before applying the styles(bold, italic, font color) right?

@LuciAkirami I just assigned you to this issue.

The intention behind this issue is to provide an easy way for someone who wants to use the syntect crate to be able to use this crate.

So basically the idea is to take this:

https://github.com/r3bl-org/r3bl_rs_utils/blob/main/tui/src/tui/syntax_highlighting/syntect_to_styled_text_conversion.rs#L64

image

and make a version of it that works with this crate AnsiStyledText as the output.