Skip to content

SnipMeDev/KodeView

 
 

Repository files navigation

kodeview_banner_opaque

KodeView

Kotlin Compose Multiplatform components for syntax highlighting based on Highlights library.

Preview

Android iOS

Installation

TBD

Components

CodeTextView

The basic component that takes instance of Highlights and applies coloring on text.

Android

@Composable
fun MyApp() {
    val highlights = remember {
        mutableStateOf(
            Highlights
                .default()
                .getBuilder()
                .code("public static void main(String[] args) {}")
                .build()
        )
    }

   MaterialTheme {
      Column {
        CodeTextView(highlights = highlights.value)
      }
   }
}

iOS

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()
        }
    }
}

Packages

No packages published

Contributors 2

  •  
  •  

Languages