Kotlin Compose Multiplatform components for syntax highlighting based on Highlights library.
Android | iOS |
---|---|
![]() |
![]() |
TBD
The basic component that takes instance of Highlights and applies coloring on text.
@Composable
fun MyApp() {
val highlights = remember {
mutableStateOf(
Highlights
.default()
.getBuilder()
.code("public static void main(String[] args) {}")
.build()
)
}
MaterialTheme {
Column {
CodeTextView(highlights = highlights.value)
}
}
}
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
@State var highlights = Highlights.companion.default()
init() {
highlights.setCode(code: "public static void main(String[] args) {}")
}
var body: some View {
VStack {
CodeTextView(newHighlights: $highlights)
.ignoresSafeArea(.keyboard)
.padding()
}
}
}