3cc7f220cd
Chromium's native selection copy serializes the selection as text/html with every element's computed color inlined. Copied from a dark theme, body text lands on the clipboard as near-white (the app ink computes to color(srgb 0.902 0.929 0.953 / 0.94)); pasted into a light-background target such as an email, it is invisible. The renderer never writes rich text itself, so this payload can only come from Chromium's serializer — which runs after copy handlers decline, meaning clipboardData reads back empty inside the event. The new guard therefore decides from the live DOM: it scores the computed ink of the selected text against the rendered theme mode, and only when they are opposite schemes does it own the payload, writing text/plain plus a tag-structured text/html with no paint declarations. Structure (headings, lists, tables, links, bold/italic, code layout) survives; colors come from the paste target's defaults. A generic font-family anchor (sans-serif, monospace inside code) keeps receivers that convert HTML to rich text on their own compose font instead of the Times browser default. Same-scheme copies and selections starting inside editable fields pass through untouched.