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
- Host: GitHub
- URL: https://github.com/ziglibs/lscolors
- Owner: ziglibs
- License: mit
- Created: 2019-11-03T15:47:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2026-04-10T14:54:41.000Z (3 months ago)
- Last Synced: 2026-04-25T01:40:08.797Z (3 months ago)
- Topics: ls-colors, zig, zig-package, ziglang
- Language: Zig
- Homepage:
- Size: 104 KB
- Stars: 20
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - lscolors🗒️A zig library for colorizing paths according to LS_COLORS
README
# lscolors

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)});
}
}
```