S or /

SourceModule syntax_highlighting

Syntax highlighting for code.

Turn on the syntect feature for great syntax highlighting of any language. Otherwise, a very simple fallback will be used, that works okish for C, C++, Rust, and Python.

Classes§

CodeTheme

Functions§

code_view_ui

View some code with syntax highlighting and selection.

highlight

Add syntax highlighting to a code string.

SourceFunction code_view_ui§

from egui.syntax_highlighting import code_view_ui
def code_view_ui(ui: Ui, theme: CodeTheme, code: str, language: str) -> Response

View some code with syntax highlighting and selection.

SourceFunction highlight§

from egui.syntax_highlighting import highlight
def highlight(ctx: Context, style: Style, theme: CodeTheme, code: str, language: str) -> LayoutJob

Add syntax highlighting to a code string.

The results are memoized, so you can call this every frame without performance penalty.

Constants§

Re-exports§