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) is a lightweight Kotlin library for generating ASCII art. It provides a simple API to convert text into ASCII art.
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:
repositories {
maven("https://jitpack.io")
}
Next, add KInk as a dependency:
dependencies {
implementation("com.github.Derrick-Mwendwa:kotlin-ink:1.1.1")
}
KInk provides several methods to print ASCII art from text. Below are examples demonstrating how to use each method.
To print text as ASCII art directly to the console, use the say
method:
import tech.derrickmwendwa.KInk
fun main() {
KInk.say("Hello, World!")
}
You can also direct the ASCII art to any OutputStream
:
import tech.derrickmwendwa.KInk
fun main() {
KInk.say("Hello, World!", System.out)
}
For more control over the output, you can provide a custom output function:
import tech.derrickmwendwa.KInk
fun 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.
- Basic Shapes and Patterns
- Image to ASCII Art
- Color Support
- Performance Optimizations
- Documentation
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.
This project is licensed under the MIT License - see the LICENSE file for details.