https://github.com/serbelga/compose-vectorize
A Kotlin Multiplatform library to generate compose.ui.graphics.vector.ImageVector from XML files
https://github.com/serbelga/compose-vectorize
compose compose-multiplatform imagevector kotlinpoet multiplatform vector xml
Last synced: 6 months ago
JSON representation
A Kotlin Multiplatform library to generate compose.ui.graphics.vector.ImageVector from XML files
- Host: GitHub
- URL: https://github.com/serbelga/compose-vectorize
- Owner: serbelga
- Created: 2024-01-01T21:15:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-17T20:40:46.000Z (6 months ago)
- Last Synced: 2025-12-21T08:39:19.612Z (6 months ago)
- Topics: compose, compose-multiplatform, imagevector, kotlinpoet, multiplatform, vector, xml
- Language: Kotlin
- Homepage: http://sergiobelda.dev/compose-vectorize/
- Size: 908 KB
- Stars: 78
- Watchers: 1
- Forks: 2
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Compose Vectorize
[](https://search.maven.org/search?q=g:dev.sergiobelda.compose.vectorize)
A Kotlin Multiplatform library to generate `compose.ui.graphics.vector.ImageVector` from `.xml` files.
Visit the [project website](https://sergiobelda.dev/compose-vectorize/) for documentation.
## Usage
Create a folder called `xml-images` in the module folder.
`:module/xml-images`
### Android

### Multiplatform

### Generate images
You can manually generate ImageVector for these XML files by calling `gradle generateImages`. This will create a Kotlin file for each XML file containing the ImageVector in the build folder.
Now, you can use reference this image in the Compose code:
```kotlin
Icon(Images.Icons.Add, contentDescription = null)
```
Note that automatically a category called "Icons" has been created. A category is created for each subfolder in `xml-images` folder.
-------------------
## Themed Attributes
It also supports theme attributes. If you are using theme color attributes, like `?attr/colorPrimary`
or `?attr/colorSecondary`, they can be converted to Compose `MaterialTheme` tokens, which means that
you can update illustration colors based on the token values. It is also compatible with Material3 dynamic colors.
It also supports theme attributes. If you are using theme color attributes, like `?attr/colorPrimary`
or `?attr/colorSecondary`, they can be converted to Compose `MaterialTheme` tokens, which means that
you can update illustration colors based on the token values. It is also compatible with Material3 dynamic colors.
```xml
```
> [!NOTE]
> It requires use Compose Material 3 dependency.
-------------------
## License
```
Copyright 2024 Sergio Belda
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```