Skip to content

A simple syntax highlighter to use with TextView or Compose Text. Supported Kotlin, Java, JavaScript and Python.

Notifications You must be signed in to change notification settings

cinkhangin/glow

Repository files navigation

screenshot

glow

A simple syntax highlighter to use with TextView. Kotlin, Java, JavaScript, and Python are Supported.

dependencies {
    implementation("com.naulian:glow:1.8.0")
}
val sourceCode = "print('hello')"
val language = "py" //or "python"

val highlighted = glowSyntax(sourceCode, language, CodeTheme.kotlinLight)
//textView.text = highlighted.raw 
textView.setCodeTheme(CodeTheme.kotlinLight.normal)
textView.text = highlighted.spanned

//compose
val annotatedHighLight = Glow.highlight(sourceCode, language, CodeTheme.kotlinLight)
Text(text= annotatedHighLight.value)

About

A simple syntax highlighter to use with TextView or Compose Text. Supported Kotlin, Java, JavaScript and Python.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •