GETTING STARTED
From dependency
to your first QR.
Choose your platform, add the library and start with a shared theme.
Examples use published version 0.5.5.
01 / ANDROID & KOTLIN
Add the shared engine.
Add JitPack to the dependency repositories in
settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}
Add the core module to your application:
dependencies {
implementation(
"com.github.EugenePonomarev.styled-qr-kmp:qrcode-core:0.5.5"
)
}
Encode text, choose a theme and render an SVG:
import io.github.eugeneponomarev.styledqr.core.QrCodeGenerator
import io.github.eugeneponomarev.styledqr.render.SvgQrRenderer
import io.github.eugeneponomarev.styledqr.theme.QrThemes
val qrCode = QrCodeGenerator.encodeText("https://eugeneponomarev.github.io/styled-qr-kmp/")
val style = QrThemes.Fintech.createStyle()
val svg = SvgQrRenderer.render(qrCode, style)
Building an Android interface? See the View and Compose examples .
02 / iOS
Render a native image.
Download StyledQrKmp.xcframework.zip from a GitHub
Release. Add the extracted framework to your Xcode target and
import StyledQrKmp.
import UIKit
import StyledQrKmp
let renderer = StyledQrImageRenderer()
renderer.content = "https://eugeneponomarev.github.io/styled-qr-kmp/"
let image = renderer.render(
sizePoints: 240,
scale: 0
)
If rendering returns nil, inspect
renderer.lastRenderError. See the
UIKit and SwiftUI guide
for integration examples.
03 / WEB
Generate SVG in the browser.
Install the published ES module:
npm install styled-qr-kmp-web@0.5.5
Create options and render a themed QR:
import {
StyledQrOptions,
renderStyledQrSvg,
} from "styled-qr-kmp-web";
const options = new StyledQrOptions();
options.themeId = "fintech";
options.errorCorrection = "H";
const result = renderStyledQrSvg(
"https://eugeneponomarev.github.io/styled-qr-kmp/",
options,
);
if (result.error != null) {
throw new Error(result.error.message);
}
if (result.svg != null) {
console.log(result.svg);
}
The result can also represent empty input without an SVG or error. For a complete browser example, see the Web quick start .
NEXT STEP
Make it yours.
Explore themes and styling examples, then test the final image.