Files
ARCADIA-Studio/harness/experiments/palette-readability-20260913/palette-foundation-source-handoff-20260912.md
T

76 lines
8.2 KiB
Markdown

# Palette foundation source handoff
2026-09-12. Root owns issue #26, integration, compiler gates and native acceptance. This is an isolated candidate implementation, not issue closure or an accepted display result.
- Branch: `codex/palette-foundation-956atf-20260912`
- Worktree: `.local/palette-foundation-20260912`
- Base: `f6595ebf66e88ec42c37b5c1a3c014f5e52cb32d`
- Contribution: `02c2f6f46e57cf2cb00c2df789fbbad6caf973e7` — Strengthen palette roles and source selection contrast
- Scope: exactly four files below. No behavior, architecture/state painter, lifecycle, lexer, source action/persistence, manifest, dependency or root tracked changes.
## Implemented candidate
`style::theme()` uses the installed `Theme::custom_with_fn` API and explicit shared Extended pairs. Existing application/input BG is preserved. Semantic secondary ink is `#4B5968`; teal is `#00665C`. Essential `pub const BOUNDARY` is `#667586`, distinct from unchanged decorative LINE. It already supplies input/pick-list/menu/checkbox boundaries through the theme and is ready for the independently owned canvas-consumer replacements.
This is **A refined**, not original A unchanged: parent chose a slightly darker global ink to make ordinary selection both visible and readable without changing the surface. Final INK `#18212C` and ordinary input selection `#7B8E86` have approximately 4.684305 value/selection, 3.137133 selection/BG and 14.695286 value/BG contrast. Comparison `#1C2530` / `#7C9188` yielded only 4.616181 and 3.033414 for the first two measures. These are source-color arithmetic; actual f32-resolved Rust tests remain unrun.
The actor, generic and amber kind-color families darken to A's proposed values. Existing category mapping and the other kind families remain. Shared teal darkens activity/function colors naturally. No category semantics, text, shapes or lexer classes change.
Selected navigation retains a light `#D9EEE8` fill and gains a 2 px teal outline, using the existing style API. It no longer overwrites disabled text opacity inherited from the base navigation style. This is an outline, not a new leading marker or focus-management implementation.
The single source editor call gains `.style(style::source_editor)`. Its white surface, `#80958B` selection and `#212529` fallback/placeholder/caret are separate from ordinary input values. `highlight::format` uses the exact seven S2 colors from the [selection remedy](palette-selection-remedy-20260912.md), with unchanged font and lexer behavior. S2 source arithmetic gives 3.186824 selection/surface and at least 4.835525 selected-token/fallback contrast. No range tracking, additional retokenization or selected-foreground lifecycle is added.
## Shared-role couplings and implementation choice
Iced `Pair::new` silently adjusts text using `Color::is_readable_on`'s **6.0** threshold. Therefore the generator uses a local Pair-literal constructor to preserve reviewed values exactly; resolved tests enforce the intended consumer contrasts. It does not rely on Iced's adaptive color output or introduce a theme abstraction.
- `background.weak` supplies white pick-list/menu/hovered unchecked-checkbox and disabled-input surfaces. It is not darkened as a border token.
- `background.strong` supplies BOUNDARY borders and the disabled checked primary checkbox fill. Its own text pair is white; some checkbox variants use other pair text, so pair-local checks alone would not suffice.
- `secondary.base` supplies both MUTED placeholders and secondary-button fill. Its text is white, with a darker explicit hover fill.
- Primary base/strong supply teal actions, focused/open borders, checked boxes and menu selection. Hovered buttons and checkboxes can retain base text while consuming strong fill; the tests check resolved output.
- `primary.weak.color` supplies ordinary input selection. The source editor overrides selection/value/surface locally rather than forcing S2 onto ordinary fields.
- Shared success/warning/danger pairs are explicit and coherent with the light theme. Existing disabled-button alpha behavior is retained and is not evaluated as if it were opaque active text.
## Verification performed and deferred
Performed in the isolated worktree: source/API inspection, `rustfmt --edition 2024 --config skip_children=true` on the four owned Rust files (exit 0), and `git diff --check` (exit 0). The view diff is exactly one style call. Git commit succeeded and the worktree status was clean immediately afterward. No Cargo, rustc, native UI or Gitea operation was performed.
Seven tests are **declared, not run** in `style/tests.rs`:
1. `semantic_text_and_essential_boundaries_have_contrast_on_canvas_surfaces`
2. `source_editor_syntax_and_fallback_remain_readable_during_selection`
3. `default_input_styles_keep_ordinary_values_and_visible_selection`
4. `default_pick_list_and_menu_styles_cover_open_and_selected_states`
5. `default_checkbox_styles_keep_checks_and_outlines_distinct`
6. `button_pair_couplings_cover_hover_and_disabled_states`
7. `selected_navigation_adds_a_visible_outline_and_preserves_disabled_ink`
They use actual theme, formatter and Iced default style functions, not a copied hypothetical palette. They cover all 39 kind headers on the painter's tint, relevant diagram surfaces, every source class, enabled input statuses, disabled input values, opened pick lists/selected popup rows, checked/unchecked primary boxes, five filled button families across active/hover/pressed, and disabled/nav behavior. Opaque contrast helpers reject alpha/gradients rather than mismeasure them. Disabled button alpha and inactive unchecked borders are explicitly exempt from active-state contrast floors; this does not claim their perceptual quality is verified. Non-default success/secondary/danger checkbox variants are not used by current production call sites and are not claimed covered by the primary-checkbox evaluator.
After the parent combines the independently owned painter contribution and grants a compiler lease, a targeted command is:
```powershell
cargo test --locked -p oa-desktop --bin arcadia-studio style::tests -- --nocapture
```
Use the parent's identified-input Windows gate environment and isolated/serialized target policy. Require a listing selecting all seven tests; compilation alone or zero selected tests is not evidence. The normal integrated full/strict and native gates remain necessary. No compile success is claimed here.
## Remaining acceptance and geometry boundaries
- Actual candidate rendering, syntax hue scanability, display degradation and native editing tasks are unverified. Near-black syntax is an explicit tradeoff, with improved foreground/range contrast but less saturated scanning information.
- Essential canvas LINE/edge consumers remain for the parent's separate contribution; exposing BOUNDARY alone does not change those still-hardcoded outlines. Shared token consumers naturally receive changed INK/MUTED/TEAL values.
- Warning-route symbols, state-row selection markers and any separate focus geometry are not implemented in these four files. A selected nav outline does not imply keyboard-focused buttons receive a new focus indicator.
- Iced can produce no selection rectangles for newline-only selection and omit blank-line fill; range paint disappears on blur. These source-derived geometry limits remain unchanged. The native acceptance matrix in the selection remedy includes them and must record actual behavior rather than silently narrowing universal selection visibility.
- Existing painter-continuity screenshot predicates may depend on old selected colors. Update only the color recognition when combining, while retaining the geometric continuity requirement.
## Exact payload hashes
| File under the worktree | SHA-256 |
|---|---|
| `crates/oa-desktop/src/style.rs` | `924e6a92bc28c9f07936c8ab0bc41b6f097956ef4c0e24a571d7fa6fb6591382` |
| `crates/oa-desktop/src/style/tests.rs` | `4a3f7486bfa85129d1504f7a0990e28325bd704770f814f255d5044996246dcd` |
| `crates/oa-desktop/src/highlight.rs` | `8222e2deed5d60ea522241ccb2c653caf50ecc1d4404d633f54e0193c5f622e9` |
| `crates/oa-desktop/src/views.rs` | `1c0b1197d3bf3d3f7aaaea2cf8a89bf4f7e2634e65345f81693fc91df151b9c3` |
Parent owns independent review, combination, execution, evidence archive and any eventual acceptance/publication.