mod(container/border): change default configuration

This commit is contained in:
2025-02-08 13:52:01 +01:00
parent 29ae75adf5
commit c72d76470a
2 changed files with 10 additions and 7 deletions

View File

@@ -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();

View File

@@ -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 {