mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-21 03:34:54 +00:00
Enable true color output (closes #705)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -14,9 +14,9 @@ random: Random,
|
||||
width: usize,
|
||||
height: usize,
|
||||
buffer: [*]termbox.tb_cell,
|
||||
fg: u16,
|
||||
bg: u16,
|
||||
border_fg: u16,
|
||||
fg: u32,
|
||||
bg: u32,
|
||||
border_fg: u32,
|
||||
box_chars: struct {
|
||||
left_up: u32,
|
||||
left_down: u32,
|
||||
@@ -170,7 +170,7 @@ pub fn drawLabel(self: TerminalBuffer, text: []const u8, x: usize, y: usize) voi
|
||||
drawColorLabel(text, x, y, self.fg, self.bg);
|
||||
}
|
||||
|
||||
pub fn drawColorLabel(text: []const u8, x: usize, y: usize, fg: u16, bg: u16) void {
|
||||
pub fn drawColorLabel(text: []const u8, x: usize, y: usize, fg: u32, bg: u32) void {
|
||||
const yc: c_int = @intCast(y);
|
||||
const utf8view = std.unicode.Utf8View.init(text) catch return;
|
||||
var utf8 = utf8view.iterator();
|
||||
|
||||
@@ -12,8 +12,8 @@ const InfoLine = @This();
|
||||
const Message = struct {
|
||||
width: u8,
|
||||
text: []const u8,
|
||||
bg: u16,
|
||||
fg: u16,
|
||||
bg: u32,
|
||||
fg: u32,
|
||||
};
|
||||
|
||||
label: MessageLabel,
|
||||
@@ -28,7 +28,7 @@ pub fn deinit(self: InfoLine) void {
|
||||
self.label.deinit();
|
||||
}
|
||||
|
||||
pub fn addMessage(self: *InfoLine, text: []const u8, bg: u16, fg: u16) !void {
|
||||
pub fn addMessage(self: *InfoLine, text: []const u8, bg: u32, fg: u32) !void {
|
||||
if (text.len == 0) return;
|
||||
|
||||
try self.label.addItem(.{
|
||||
|
||||
@@ -5,11 +5,11 @@ const termbox = interop.termbox;
|
||||
|
||||
pub const Cell = struct {
|
||||
ch: u32,
|
||||
fg: u16,
|
||||
bg: u16,
|
||||
fg: u32,
|
||||
bg: u32,
|
||||
};
|
||||
|
||||
pub fn initCell(ch: u32, fg: u16, bg: u16) Cell {
|
||||
pub fn initCell(ch: u32, fg: u32, bg: u32) Cell {
|
||||
return .{
|
||||
.ch = ch,
|
||||
.fg = fg,
|
||||
|
||||
Reference in New Issue
Block a user