From c4c0a4946608595f3303c2b1402ddd7ada495207 Mon Sep 17 00:00:00 2001 From: Martino Ferrari Date: Sat, 3 Oct 2026 14:42:06 +0200 Subject: [PATCH] style(grid): brighter major grid grid_major 0x2A3038 -> 0x39414C, still well under axis_line's 0x8A94A6, so the three-way hierarchy the eye reads stays minor < major < axis. Already fully opaque, so "more prominent" meant a brighter colour and nothing else. The tests that classify grid pixels take their colours from the style, so they followed the change; the one hardcoded mention (grid_pixel()'s doc comment) is updated, and the minor's relationship to the major is now stated as an order of magnitude rather than the fifth the old colours happened to give. 361 cases, 0 failed. --- docs/styling.md | 4 ++-- include/plot/render/style.hpp | 11 ++++++++--- tests/test_render_smoke.cpp | 7 ++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/styling.md b/docs/styling.md index db201a6..56773df 100644 --- a/docs/styling.md +++ b/docs/styling.md @@ -36,7 +36,7 @@ Colours (neither logical nor device — nothing to scale): | field | default | meaning | |---|---|---| | `background` | `0x101418` | frame clear colour and legend/readout panel base | -| `grid_major` | `0x2A3038` | major (labelled-tick) grid lines | +| `grid_major` | `0x39414C` | major (labelled-tick) grid lines | | `grid_minor` | `0x1C2126` at 50% alpha | minor (subdivision) grid lines | | `axis_line` | `0x8A94A6` | axis lines | | `axis_text` | `0xC8D0DC` | tick labels and axis titles | @@ -99,7 +99,7 @@ grid's three defaults are what makes that read: it is thinner than the major hai display as a narrower line), its colour carries an **alpha** so it blends into the background instead of sitting on it, and it is **dashed** (`grid_minor_dash_on`/`_off`) so an unlabelled line at an unlabelled position is never mistaken for a labelled one. Together -those put a minor line at roughly a fifth of a major line's ink — at full opacity and the +those put a minor line at an order of magnitude less ink than a major one — at full opacity and the same width a dense minor grid reads as a second set of ticks. The dash is a fragment-shader discard, not extra geometry: the vertices are the line either way. Set `grid_minor_dash_off = 0` for the old solid subdivision. diff --git a/include/plot/render/style.hpp b/include/plot/render/style.hpp index ba67c40..7f46fca 100644 --- a/include/plot/render/style.hpp +++ b/include/plot/render/style.hpp @@ -38,13 +38,18 @@ struct Style { // --- colours: neither logical nor device, so nothing to scale ------------ Color background = Color::hex(0x101418); - Color grid_major = Color::hex(0x2A3038); + /// The labelled grid. Brighter than the subdivisions and still well under `axis_line` + /// (0x8A94A6): the grid is structure the eye can read, the axis is the frame, and the + /// hierarchy between the three is what keeps a dense plot legible. It is already fully + /// opaque, so "more prominent" means a brighter colour and nothing else. + Color grid_major = Color::hex(0x39414C); /// The minor grid's colour, **with an alpha** so it blends into the background rather than /// sitting on it: a subdivision is a reading aid, and at full opacity a dense minor grid /// reads as a second set of ticks competing with the labelled one. The line shader applies /// `u_color.a` (see `src/render/shaders.cpp`), so this one blends and the major -- opaque at - /// 0x2A3038 -- stays the structure the eye picks out. Together with `grid_minor_width` and - /// the dash below, the defaults put a minor line at roughly a fifth of a major line's ink. + /// 0x39414C -- stays the structure the eye picks out. Together with `grid_minor_width` and + /// the dash below, the defaults put a minor line at an order of magnitude less ink than a + /// major one. Color grid_minor = Color::hex(0x1C2126, 0.5f); Color axis_line = Color::hex(0x8A94A6); Color axis_text = Color::hex(0xC8D0DC); diff --git a/tests/test_render_smoke.cpp b/tests/test_render_smoke.cpp index 610a38a..8c30c33 100644 --- a/tests/test_render_smoke.cpp +++ b/tests/test_render_smoke.cpp @@ -5481,9 +5481,10 @@ plot::i32 densest_column(const std::vector& frame, plot::u32 fb_w, plo return best; } -/// The grid *majors* (0x2A3038 over the 0x101418 background), which no other element of these -/// frames reaches: the minors are 0x1C2126 (too dark for the bound), the crosshair is near-white, -/// a trace is saturated and the cursor is the orange accent. +/// The grid *majors* (0x39414C over the 0x101418 background), which no other element of these +/// frames reaches: the minors are that same colour at 50% alpha over a 0.75-covered dashed +/// stroke, so their brightest pixel is about 15 levels off the background and stays under this +/// bound; the crosshair is near-white, a trace is saturated and the cursor is the orange accent. bool grid_pixel(const plot::u8 px[4]) { const plot::u8 lo = std::min(px[0], std::min(px[1], px[2])); const plot::u8 hi = std::max(px[0], std::max(px[1], px[2]));