refactor: zigify imports and correct minor mistakes
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub const Color = enum(u8) {
|
||||
default = 0,
|
||||
black = 16,
|
||||
@@ -25,16 +23,19 @@ pub const Color = enum(u8) {
|
||||
pub inline fn write(this: Color, writer: anytype, comptime coloring: enum { fg, bg, ul }) !void {
|
||||
if (this == .default) {
|
||||
switch (coloring) {
|
||||
.fg => try std.fmt.format(writer, "39", .{}),
|
||||
.bg => try std.fmt.format(writer, "49", .{}),
|
||||
.ul => try std.fmt.format(writer, "59", .{}),
|
||||
.fg => try format(writer, "39", .{}),
|
||||
.bg => try format(writer, "49", .{}),
|
||||
.ul => try format(writer, "59", .{}),
|
||||
}
|
||||
} else {
|
||||
switch (coloring) {
|
||||
.fg => try std.fmt.format(writer, "38;5;{d}", .{@intFromEnum(this)}),
|
||||
.bg => try std.fmt.format(writer, "48;5;{d}", .{@intFromEnum(this)}),
|
||||
.ul => try std.fmt.format(writer, "58;5;{d}", .{@intFromEnum(this)}),
|
||||
.fg => try format(writer, "38;5;{d}", .{@intFromEnum(this)}),
|
||||
.bg => try format(writer, "48;5;{d}", .{@intFromEnum(this)}),
|
||||
.ul => try format(writer, "58;5;{d}", .{@intFromEnum(this)}),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const std = @import("std");
|
||||
const format = std.fmt.format;
|
||||
|
||||
Reference in New Issue
Block a user