Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derrick-mwendwa/kotlin-ink
KInk is a Kotlin-based ASCII art library. It provides a simple API to print text in ASCII art format.
https://github.com/derrick-mwendwa/kotlin-ink
ascii-art gradle java jvm kotlin library
Last synced: 4 months ago
JSON representation
KInk is a Kotlin-based ASCII art library. It provides a simple API to print text in ASCII art format.
- Host: GitHub
- URL: https://github.com/derrick-mwendwa/kotlin-ink
- Owner: Derrick-Mwendwa
- License: mit
- Created: 2024-05-03T16:25:48.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-06-20T12:32:08.000Z (8 months ago)
- Last Synced: 2024-09-30T13:03:48.343Z (4 months ago)
- Topics: ascii-art, gradle, java, jvm, kotlin, library
- Language: Kotlin
- Homepage:
- Size: 85 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> [!IMPORTANT]
> The dependency has changed from `tech.derrickmwendwa:kotlin-ink:version` to `com.github.Derrick-Mwendwa:kotlin-ink:version`. Please update your `build.gradle.kts` file accordingly.# KInk (Kotlin Ink)
KInk (Kotlin Ink) is a lightweight Kotlin library for generating ASCII art. It provides a simple API to convert text
into ASCII art.## Installation
### Jitpack
[![](https://jitpack.io/v/Derrick-Mwendwa/kotlin-ink.svg)](https://jitpack.io/#Derrick-Mwendwa/kotlin-ink)
KInk is available on JitPack. You can add it to your project by following the instructions below.
To add KInk to your project, you need to add the JitPack repository to your `build.gradle.kts` file:
```kotlin
repositories {
maven("https://jitpack.io")
}
```Next, add KInk as a dependency:
```kotlin
dependencies {
implementation("com.github.Derrick-Mwendwa:kotlin-ink:1.1.1")
}
```## Usage
KInk provides several methods to print ASCII art from text. Below are examples demonstrating how to use each method.
### Print ASCII Art to Console
To print text as ASCII art directly to the console, use the `say` method:
```kotlin
import tech.derrickmwendwa.KInkfun main() {
KInk.say("Hello, World!")
}
```### Print ASCII Art to an OutputStream
You can also direct the ASCII art to any `OutputStream`:
```kotlin
import tech.derrickmwendwa.KInkfun main() {
KInk.say("Hello, World!", System.out)
}
```### Custom Output Function
For more control over the output, you can provide a custom output function:
```kotlin
import tech.derrickmwendwa.KInkfun main() {
KInk.say("Hello, World!") { line ->
println(line)
}
}
```The lambda function receives line by line ASCII art output, not the entire text.
> [!CAUTION]
> Please note that not all characters are supported. If you try to print a character that is not supported, an `IllegalArgumentException` will be thrown.## Upcoming Features
- Basic Shapes and Patterns
- Image to ASCII Art
- Color Support
- Performance Optimizations
- Documentation## Contributing
Contributions are welcome! Please feel free to submit a pull request if you have any improvements or open an issue if
you encounter any problems.## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.