Add: experimental adaptive placeholder palette (light/dark per ancestor sample)#229
Merged
Merged
Conversation
…or sample) Sample each placeholder's ancestor backgrounds at insert time and pick a light or dark stripe palette so redactions on dark-themed pages (e.g. dark-mode GitHub) don't flare against the page chrome. Default off and marked experimental in the Options page; also accepted as a `placeholderAdaptivePalette` reserved key in the build-time defaults file alongside `optionsButton` / `runOnInactiveTabs` / `debugTrace`. PLACEHOLDER_STYLES now exposes its colors as CSS variables; placeholders sampled as dark are stamped with `data-abs-placeholder-palette="dark"` and a single override block redefines the variables — no per-element inline styles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…pecs - docs/install.md and install SKILL.md gain the new reserved key entry alongside optionsButton / runOnInactiveTabs / debugTrace. - spec 0010 (Extension UI) FR-10 lists the new Experimental section and the adaptive-palette toggle. - spec 0011 (Build-time customization) FR-3 adds placeholderAdaptivePalette to the reserved-key inventory and points at placeholder-adaptive-palette.ts under current implementation. - defaults-overrides.example.json reflects the new key. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tion The toggle previously lived in a standalone Experimental section. Folding it next to the existing Placeholder display radio group keeps related placeholder controls together and drops a one-item section. Inline copy on the switch retains the "experimental — defaults/storage key may change" caveat so the disclaimer isn't lost. Specs 0010/0011 and install.md now point readers to *Placeholder display* as the toggle's location. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
placeholderAdaptivePalettereserved key in the build-time defaults file alongsideoptionsButton/runOnInactiveTabs/debugTrace.PLACEHOLDER_STYLESnow exposes its colors as CSS variables; placeholders sampled dark are stamped withdata-abs-placeholder-palette="dark"and a single override block redefines the variables — no per-element inline styles.How it picks the palette
pickPaletteFromAncestorwalks up from the element being replaced, readsgetComputedStyle().backgroundColor, skips backgrounds with alpha < 0.5 ("no info, keep walking"), and classifies the first opaque background by perceived brightness (Rec. 601, 0.5 threshold). Defaults to"light"when every ancestor is transparent.Classification is cached via a module-local boolean in
placeholder-adaptive-palette.tsso placeholder creation can read the toggle synchronously without achrome.storageround-trip per redaction.rule-engine.start()primes the cache from storage and subscribes for updates.Test plan
bun run check— cleanbun run test— 1919/1919 (10 new inplaceholder-adaptive-palette.test.tscovering classifier + block + inline stamping; 3 new inload-default-overrides.test.tsfor the reserved key)bun run build— succeeds; background-purity guard still passes🤖 Generated with Claude Code