mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-13 11:32:58 +01:00
improve writeFiglet function
This commit is contained in:
parent
debaff88c6
commit
fee780cff7
1 changed files with 10 additions and 10 deletions
|
@ -12,18 +12,18 @@ const figlet =
|
||||||
|
|
||||||
pub fn writeFiglet(writer: anytype) !void {
|
pub fn writeFiglet(writer: anytype) !void {
|
||||||
var style: ?at.style.Style = null;
|
var style: ?at.style.Style = null;
|
||||||
var iter = std.mem.split(u8, figlet, "\n");
|
for (figlet) |char| {
|
||||||
while (iter.next()) |line| {
|
switch (char) {
|
||||||
for (line) |char| {
|
'r' => {
|
||||||
if (char == 'r') {
|
|
||||||
try at.format.updateStyle(writer, .{ .foreground = .Red }, style);
|
try at.format.updateStyle(writer, .{ .foreground = .Red }, style);
|
||||||
style = .{ .foreground = .Red };
|
style = .{ .foreground = .Red };
|
||||||
} else {
|
},
|
||||||
try writer.writeByte(char);
|
'\n' => {
|
||||||
}
|
try at.format.updateStyle(writer, .{ .foreground = .Default }, style);
|
||||||
|
style = .{ .foreground = .Default };
|
||||||
|
try writer.writeByte('\n');
|
||||||
|
},
|
||||||
|
else => try writer.writeByte(char),
|
||||||
}
|
}
|
||||||
try at.format.updateStyle(writer, .{ .foreground = .Default }, style);
|
|
||||||
style = .{ .foreground = .Default };
|
|
||||||
try writer.writeByte('\n');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue