An open API service indexing awesome lists of open source software.

https://github.com/ziglibs/lscolors

A zig library for colorizing paths according to LS_COLORS
https://github.com/ziglibs/lscolors

ls-colors zig zig-package ziglang

Last synced: 15 days ago
JSON representation

A zig library for colorizing paths according to LS_COLORS

Awesome Lists containing this project

README

          

# lscolors

![CI](https://github.com/ziglibs/zig-lscolors/workflows/CI/badge.svg)

A zig library for colorizing paths according to the `LS_COLORS`
environment variable. Designed to work with Zig 0.16.0.

## Quick Example

```zig
const std = @import("std");

const LsColors = @import("lscolors").LsColors;

pub fn main(init: std.process.Init) !void {
const allocator = init.arena.allocator();
const io = init.io;

var lsc = try LsColors.fromEnv(allocator, init.environ_map);
defer lsc.deinit();

var dir = try std.Io.Dir.cwd().openDir(io, ".", .{ .iterate = true });
defer dir.close(io);

var iterator = dir.iterate();
while (try iterator.next(io)) |itm| {
std.log.info("{f}", .{try lsc.styled(io, itm.name)});
}
}
```