╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ ui.zig ───────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
3194 // its background (replacing whatever background it had, which 3195 // would otherwise obscure the art). 3196 if (cellIsBlank(dst.*)) { 3197 dst.* = src; 3198 dst.style.fg = sgrSafe(dimColor(dst.style.fg)); 3199 dst.style.bg = sgrSafe(dimColor(dst.style.bg)); 3200 } else { 3201 const background_maybe = sgrSafe(dimColor(src.style.bg orelse src.style.fg)); 3202 dst.style.bg = background_maybe; 3203 // change the color of text overlaying ANSI art to ensure 3204 // it is readable. don't do this in the web UI, since we 3205 // have direct control of the theme there (also, inner 3206 // scroll panes allow text to move without a re-render 3207 // by the TUI, which would break this). also don't do this 3208 // if the text is explicitly styled. 3209 if (is_terminal and dst.style.fg == null) { 3210 if (background_maybe) |background| { 3211 // use near-black and near-white, which is easier on the eyes 3212 // while retaining high contrast 3213 const luminance = (@as(u32, background.r) * 299 + 3214 @as(u32, background.g) * 587 + 3215 @as(u32, background.b) * 114) / 1000; 3216 dst.style.fg = if (luminance >= 128) 3217 .{ .r = 16, .g = 16, .b = 16 } 3218 else 3219 .{ .r = 240, .g = 240, .b = 240 }; 3220 } 3221 } 3222 } 3223 } 3224 } 3225 } 3226 return out; 3227 } 3228 }; 3229