Declarative styling + layout
Style, Border, Table, List, Tree, Layout::join, Place, multi-layer Canvas, and Theme — the canonical colour palette for all SugarCraft libs. Pure rendering — no I/O — so you can render frames inside a unit test.
composer require sugarcraft/candy-sprinkles
use SugarCraft\Sprinkles\{Style, Border, Layout, Position};
use SugarCraft\Sprinkles\Table\Table;
use SugarCraft\Core\Util\Color;
$banner = Style::new()
->bold()
->foreground(Color::hex('#ff5f87'))
->padding(0, 2)
->render('hello, candy world');
$table = Table::new()
->headers('Name', 'Age')
->row('Alice', '30')
->row('Bob', '25')
->border(Border::rounded())
->render();
echo Layout::joinVertical(Position::LEFT, $banner, $table);
with*() chain.Border::rounded(), thick(), double(), hidden(), normal(), ascii().joinHorizontal, joinVertical, place, placeOverlay for popovers.with*() setters return a new Theme.| Class | Method | Description |
|---|---|---|
| Theme | dark() / light() / dracula() / tokyoNight() / oneDark() / githubDark() / solarizedDark() / solarizedLight() / ansi() / adaptive() | Named theme factories |
| Theme | withPrimary($c) / withForeground($c) / withBackground($c) / withError($c) / … | 13 colour slot setters — all return a new Theme |
| Style | new() | Create a new style |
| Style | foreground(color) | Set foreground color |
| Style | background(color) | Set background color |
| Style | bold(), italic(), underline(), blink(), rapidBlink() | Text effects (blink = SGR 5, rapidBlink = SGR 6) |
| Style | patch($other) | Incremental merge — only props set in $other are applied |
| BorderGradientBlend | fromColors(Color ...$colors) | 1-5 colors → 4 interpolated border-side colors |
| Style | padding(top, right, bottom, left) | Add padding |
| Style | render(content) | Render styled content |
| Border | rounded(), thick(), double(), hidden() | Border style presets |
| Table | new() | Create a table |
| Table | headers(...), row(...) | Add table content |
| Layout | joinVertical(), joinHorizontal() | Join layouts |
| Canvas | new() | Create multi-layer canvas |
VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.