refactor: move faint-opacity clamping to config finalization

pull/8472/head
Pavel Ivanov 2025-08-31 17:19:51 +02:00
parent fc6266133f
commit 6319464cfb
No known key found for this signature in database
GPG Key ID: F5CC013DCA22C49A
2 changed files with 3 additions and 1 deletions

View File

@ -4024,6 +4024,8 @@ pub fn finalize(self: *Config) !void {
if (self.@"auto-update-channel" == null) {
self.@"auto-update-channel" = build_config.release_channel;
}
self.@"faint-opacity" = std.math.clamp(self.@"faint-opacity", 0.0, 1.0);
}
/// Callback for src/cli/args.zig to allow us to handle special cases

View File

@ -585,7 +585,7 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
.background = config.background.toTerminalRGB(),
.foreground = config.foreground.toTerminalRGB(),
.bold_color = config.@"bold-color",
.faint_opacity = @intFromFloat(@ceil(std.math.clamp(config.@"faint-opacity", 0.0, 1.0) * 255)),
.faint_opacity = @intFromFloat(@ceil(config.@"faint-opacity" * 255)),
.min_contrast = @floatCast(config.@"minimum-contrast"),
.padding_color = config.@"window-padding-color",