$ show JakeWharton/picnic
Picnic is a Kotlin multiplatform library for constructing and rendering text-based tables. It provides a Kotlin DSL and Java builder API to define tables with features like borders, padding, text alignment, row/column spans, headers/footers, and multiple border styles (solid, rounded, ASCII). The library is well-architected with a clear separation between the model (Table, Cell, CellStyle), the DSL (dsl.kt), and the rendering engine (textRender.kt). The rendering algorithm performs a two-pass measurement and layout to handle complex cell spans and border merging, using a TextCanvas from the crossword library for drawing. The code is idiomatic Kotlin, fully multiplatform (JVM, JS, Native), and includes comprehensive tests. It is actively maintained with modern tooling (Kotlin 2.4, Gradle 9.6, Renovate for dependency updates).
The LLM identified 1 files worth highlighting for reuse:
The TextBorder class defines a set of 16 border characters used for drawing table borders. It uses a bitmask-based lookup (get method) to select the correct character based on which sides (down, up, right, left) are active. This is a self-contained, immutable configuration object that can be extracted and reused in any text-based table or grid rendering project. It also provides predefined instances (DEFAULT, ROUNDED, ASCII) and demonstrates a clean pattern for encoding a small set of related constants with efficient access.