Skip to content

Commit 1a40e6a

Browse files
authored
Update readme
1 parent e5be833 commit 1a40e6a

1 file changed

Lines changed: 119 additions & 9 deletions

File tree

README.md

Lines changed: 119 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Compose QR Code
2-
__A simple, flexible QR Code Renderer For Jetpack Compose__
2+
__A simple, flexible QR code renderer for Jetpack Compose - by *Lightspark*__
33

4-
<img src="./docs/images/purple_and_gold.png" width="150px" height="150px" />
5-
<img src="./docs/images/lightning.png" width="150px" height="150px" />
6-
<img src="./docs/images/light_smile_square.png" width="150px" height="150px" />
4+
| <img src="./docs/images/purple_and_gold.png" width="150px" height="150px" /> | <img src="./docs/images/lightning.png" width="150px" height="150px" /> | <img src="./docs/images/light_smile_square.png" width="150px" height="150px" /> | <img src="./docs/images/dark_smile_circle.png" width="150px" height="150px" /> |
5+
| --- | --- | --- | --- |
76

87
## Usage
98

109
Here's a plain ol' boring QR Code:
1110

11+
<table>
12+
<tr>
13+
<td>
14+
1215
```kotlin
1316
@Composable
1417
fun BoringPreview() {
@@ -19,11 +22,18 @@ fun BoringPreview() {
1922
}
2023
```
2124

22-
It'll look like this:
23-
25+
</td>
26+
<td>
2427
<img src="./docs/images/boring.png" width="150px" height="150px" />
28+
</td>
29+
</tr>
30+
</table>
31+
32+
Meh... Let's spice it up a bit with a smiley face overlay:
2533

26-
Meh... Let's spice it up a bit with a smiley face:
34+
<table>
35+
<tr>
36+
<td>
2737

2838
```kotlin
2939
@Composable
@@ -42,10 +52,110 @@ fun SmileyPreview() {
4252
smileColor = Color.Black
4353
)
4454
}
45-
})
55+
}
56+
)
4657
}
4758
```
4859

60+
</td>
61+
<td>
4962
<img src="./docs/images/light_smile_square.png" width="150px" height="150px" />
63+
</td>
64+
</tr>
65+
</table>
66+
67+
Cool, I guess we're getting somewhere. What about dark mode? Maybe we can also add some style with circular dots in the qr code...
68+
69+
<table>
70+
<tr>
71+
<td>
72+
73+
```kotlin
74+
@Composable
75+
fun SmileyDarkPreview() {
76+
QrCodeView(
77+
data = "https://github.com/lightsparkdev/compose-qr-code",
78+
modifier = Modifier.size(300.dp),
79+
colors = QrCodeColors(
80+
background = Color.Black,
81+
foreground = Color.White
82+
),
83+
dotShape = DotShape.Circle,
84+
overlayContent = {
85+
Box(
86+
contentAlignment = Alignment.Center,
87+
modifier = Modifier
88+
.fillMaxSize()
89+
.clip(RoundedCornerShape(8.dp))
90+
.background(Color.White)
91+
.padding(8.dp)
92+
.clip(RoundedCornerShape(8.dp))
93+
.background(Color.Green)
94+
) {
95+
Smile(modifier = Modifier.fillMaxSize(0.5f))
96+
}
97+
})
98+
}
99+
```
100+
101+
</td>
102+
<td>
103+
<img src="./docs/images/dark_smile_circle.png" width="150px" height="150px" />
104+
</td>
105+
</tr>
106+
</table>
107+
108+
109+
That's not bad! Let's add some even cooler styles, though. *cracks fingers*...
110+
111+
<table>
112+
<tr>
113+
<td>
114+
115+
```kotlin
116+
@Composable
117+
fun PurpleAndGold() {
118+
val purple = Color(0xFF552583)
119+
val gold = Color(0xFFFDB927)
120+
QrCodeView(
121+
data = URL_DATA,
122+
modifier = Modifier.size(300.dp),
123+
colors = QrCodeColors(
124+
background = purple,
125+
foreground = gold
126+
),
127+
dotShape = DotShape.Circle,
128+
overlayContent = {
129+
Box(
130+
contentAlignment = Alignment.Center,
131+
modifier = Modifier
132+
.fillMaxSize()
133+
.clip(CircleShape)
134+
.background(purple)
135+
) {
136+
BasicText(
137+
text = "L",
138+
style = TextStyle.Default.copy(
139+
color = gold,
140+
fontSize = 42.sp,
141+
fontWeight = FontWeight.ExtraBold,
142+
fontStyle = FontStyle.Italic,
143+
fontFamily = FontFamily.Serif
144+
)
145+
)
146+
}
147+
}
148+
)
149+
}
150+
```
151+
152+
</td>
153+
<td>
154+
<img src="./docs/images/purple_and_gold.png" width="150px" height="150px" />
155+
</td>
156+
</tr>
157+
</table>
158+
159+
## Acknowledgements
50160

51-
TODO: Add a documentation and examples.
161+
This libraries relies on the great, reliable [zxing](https://github.com/zxing/zxing) library for QR code data generation.

0 commit comments

Comments
 (0)