diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 18:14:36 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | f41d0209f65237568c9f7d527d5989ac8921b74c (patch) | |
| tree | c313dc20fa0593ecff725de32d6ad191b01d82ac /src/draw.zig | |
| parent | b4781b334a06d16aedb0b6a3d604cb249eb619de (diff) | |
| download | pardes-f41d0209f65237568c9f7d527d5989ac8921b74c.tar.gz pardes-f41d0209f65237568c9f7d527d5989ac8921b74c.zip | |
Lift takes a style: shadow, surface, rim, glow or auto
The user wants Lift to read on dark themes, where a shadow has nothing to
darken. `Lift shadow|surface|rim|glow|auto` (`on` is auto, bare flips
auto and off): surface lightens the lifted part's ground about 5.5%
(Material-dark), rim is a thin soft light off its top and left edges,
glow a faint halo in the theme's accent (Chrome.accent, the focused box
colour), auto a shadow on a light page and surface with half a rim on a
dark one (by the page's luminance). Rim and glow are the soft kernel in a
light colour (no pre-warp: coloured light is laid on as is, within ยง8.2's
budget); each style is capped per theme so text keeps min(its contrast,
4.5) (tests: darkening and lightening over the native themes). The style
travels in the palette (Chrome.lift_style, one byte on the wire). Config
reports and ctl reads `Lift <style>`.
Shared files touched: config.zig, builtins.zig, ninep/ctl.zig,
detached/wire.zig (palette byte), gui.zig. Not touched: pardes.zig,
Messages.zig, mouse.zig.
Diffstat (limited to 'src/draw.zig')
| -rw-r--r-- | src/draw.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/draw.zig b/src/draw.zig index 70b629a5..98932c23 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -128,12 +128,12 @@ pub fn place(p: *Pardes, s: *Surface) void { spring.* = .{}; } // At this frame's own time, not the stepped animations' 16 ms grid. - spring.retarget(if (p.settings.lift and id == p.active) 1 else 0, p.now_ns); + spring.retarget(if (p.settings.lift != .off and id == p.active) 1 else 0, p.now_ns); _ = spring.step(p.now_ns); } for (s.regions[0..s.nregions]) |*region| switch (region.kind) { .grip, .tag, .body, .rail => region.lift = p.lifts[region.owner].value(p.now_ns), - .notice => region.lift = if (p.settings.lift) 1 else 0, + .notice => region.lift = if (p.settings.lift != .off) 1 else 0, else => {}, }; if (p.drag == .column_move) rail: { @@ -200,6 +200,8 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { .tag_fg = chrome.tag_fg, .scroll_track = chrome.scroll_track, .scroll_thumb = chrome.scroll_thumb, + .accent = chrome.box, + .lift_style = @intFromEnum(p.settings.lift), }; place(p, s); // Separators have their own role; a scrollbar need not frame the page. @@ -1133,7 +1135,7 @@ test "a lift is sampled at each frame's own time, and asks for frames only while p.advance(1000 * ms); _ = try p.render(arena.allocator()); try std.testing.expect(!p.continuous()); - p.settings.lift = true; + p.settings.lift = .shadow; var lifts: [3]f32 = undefined; // 144 Hz: 6.9 ms apart, none of them on a 16 ms step of its own. for (&lifts, 0..) |*lift, i| { |
