From c72d76470ae99c07cacb8cb6bc494f5d2e93675d Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Sat, 8 Feb 2025 13:52:01 +0100 Subject: [PATCH] mod(container/border): change default configuration --- examples/container.zig | 3 +-- src/container.zig | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/container.zig b/examples/container.zig index 23be427..cadd946 100644 --- a/examples/container.zig +++ b/examples/container.zig @@ -27,6 +27,7 @@ pub fn main() !void { .border = .{ .color = .blue, .corners = .rounded, + .sides = .all(), .separator = .{ .enabled = false }, }, .layout = .{ @@ -36,14 +37,12 @@ pub fn main() !void { }, }); try container.append(try App.Container.init(allocator, .{ - .border = .{ .color = .light_blue, .corners = .squared }, .rectangle = .{ .fill = .blue }, })); try container.append(try App.Container.init(allocator, .{ .border = .{ .color = .light_blue, .corners = .squared }, })); try container.append(try App.Container.init(allocator, .{ - .border = .{ .color = .light_blue, .corners = .squared }, .rectangle = .{ .fill = .blue }, })); defer container.deinit(); diff --git a/src/container.zig b/src/container.zig index 85acf6f..f4fde55 100644 --- a/src/container.zig +++ b/src/container.zig @@ -14,7 +14,7 @@ pub const Border = struct { pub const rounded_border: [6]u21 = .{ '╭', '─', '╮', '│', '╰', '╯' }; pub const squared_border: [6]u21 = .{ '┌', '─', '┐', '│', '└', '┘' }; /// Color to use for the border - color: Color = .white, + color: Color = .default, /// Configure the corner type to be used for the border corners: enum(u1) { squared, @@ -22,10 +22,14 @@ pub const Border = struct { } = .squared, /// Configure the sides where the borders shall be rendered sides: packed struct { - top: bool = true, - bottom: bool = true, - left: bool = true, - right: bool = true, + top: bool = false, + bottom: bool = false, + left: bool = false, + right: bool = false, + + pub fn all() @This() { + return .{ .top = true, .bottom = true, .left = true, .right = true }; + } } = .{}, /// Configure separator borders between child element to added to the layout separator: struct {