From 10249c33bee8f87ba1f0541e69e18894bf749eaa Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 31 May 2026 19:13:49 +0200 Subject: [PATCH] fix(stammbaum): raise dimmed opacity to 0.45 and bind tests to the constant (#703) Bump DIMMED_OPACITY 0.4 -> 0.45 so dimmed outlines/labels stay legible against bg-surface in both themes (dark mode dims already-light mint, the riskier case). Import the constant into StammbaumTree.svelte.test.ts so the node-opacity assertions track it instead of a hard-coded '0.4'. Co-Authored-By: Claude Opus 4.8 --- .../lib/person/genealogy/StammbaumTree.svelte.test.ts | 3 ++- .../lib/person/genealogy/layout/highlightLineage.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/person/genealogy/StammbaumTree.svelte.test.ts b/frontend/src/lib/person/genealogy/StammbaumTree.svelte.test.ts index c4ddd395..5434b971 100644 --- a/frontend/src/lib/person/genealogy/StammbaumTree.svelte.test.ts +++ b/frontend/src/lib/person/genealogy/StammbaumTree.svelte.test.ts @@ -2,6 +2,7 @@ import { describe, it, expect, vi } from 'vitest'; import { render } from 'vitest-browser-svelte'; import StammbaumTree from './StammbaumTree.svelte'; import type { PanZoomState } from './panZoom'; +import { DIMMED_OPACITY } from './layout/highlightLineage'; const ID_A = '00000000-0000-0000-0000-000000000001'; const ID_B = '00000000-0000-0000-0000-000000000002'; @@ -962,7 +963,7 @@ describe('StammbaumTree lineage highlight (#703)', () => { if (!fill) throw new Error(`No card-fill rect rendered for ${displayName}`); return fill.getAttribute('opacity') === null && fill.getAttribute('fill-opacity') === null; } - const DIM = '0.4'; + const DIM = String(DIMMED_OPACITY); it('renders every node at full strength when nothing is selected (AC1)', () => { render(StammbaumTree, { diff --git a/frontend/src/lib/person/genealogy/layout/highlightLineage.ts b/frontend/src/lib/person/genealogy/layout/highlightLineage.ts index a9c5a149..40846289 100644 --- a/frontend/src/lib/person/genealogy/layout/highlightLineage.ts +++ b/frontend/src/lib/person/genealogy/layout/highlightLineage.ts @@ -16,11 +16,13 @@ import type { components } from '$lib/generated/api'; type RelationshipDTO = components['schemas']['RelationshipDTO']; /** - * Opacity applied to dimmed nodes and connectors. ~0.4 keeps names legible while - * clearly de-emphasised, and works as a lightness cue in both themes (the colour - * tokens are theme-aware) so the cue does not rely on hue (WCAG 1.4.1 / NFR-A11Y-001). + * Opacity applied to dimmed node outlines/labels and connectors. 0.45 keeps names + * legible against bg-surface in both themes (dark mode dims already-light mint, the + * riskier case) while clearly de-emphasised, and works as a lightness cue so the cue + * does not rely on hue (WCAG 1.4.1 / NFR-A11Y-001). The dim is applied to the node's + * outline + labels only — the card fill stays opaque, see StammbaumNode.svelte. */ -export const DIMMED_OPACITY = 0.4; +export const DIMMED_OPACITY = 0.45; /** Adjacency index over the family graph, built once per edge set. */ export type LineageIndex = {