mirror of
https://github.com/root-fr/jmap-webmail.git
synced 2026-09-25 00:01:15 +00:00
fix: add copy-to-clipboard feedback and neutralize dark mode background tint
Copy source button now shows a checkmark and "Copied" text for 2s after clicking. Dark mode email background blend target changed to perfectly neutral gray (R=G=B) to eliminate perceived color cast on certain displays.
This commit is contained in:
@@ -425,13 +425,15 @@ export function EmailViewer({
|
||||
return source;
|
||||
};
|
||||
|
||||
const [sourceCopied, setSourceCopied] = useState(false);
|
||||
const copySourceToClipboard = async () => {
|
||||
if (!email) return;
|
||||
|
||||
try {
|
||||
const source = generateEmailSource(email);
|
||||
await navigator.clipboard.writeText(source);
|
||||
// Could add a toast notification here
|
||||
setSourceCopied(true);
|
||||
setTimeout(() => setSourceCopied(false), 2000);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
@@ -1753,8 +1755,8 @@ export function EmailViewer({
|
||||
onClick={copySourceToClipboard}
|
||||
className="flex items-center gap-1.5"
|
||||
>
|
||||
<Copy className="w-4 h-4" />
|
||||
{t('copy_source')}
|
||||
{sourceCopied ? <Check className="w-4 h-4 text-green-600 dark:text-green-400" /> : <Copy className="w-4 h-4" />}
|
||||
{sourceCopied ? tCommon('copied') : t('copy_source')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
|
||||
@@ -155,7 +155,7 @@ export function transformBgColorForDarkMode(colorString: string): string {
|
||||
if (luminance < 0.2) return colorString;
|
||||
|
||||
const blendFactor = Math.min(0.9, (luminance - 0.2) * 1.125);
|
||||
const darkR = 30, darkG = 31, darkB = 38;
|
||||
const darkR = 35, darkG = 35, darkB = 35;
|
||||
|
||||
const r = Math.max(0, Math.round(rgb.r + (darkR - rgb.r) * blendFactor));
|
||||
const g = Math.max(0, Math.round(rgb.g + (darkG - rgb.g) * blendFactor));
|
||||
@@ -244,7 +244,7 @@ export function generateIframeStylesheet(): string {
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
color: #e2e8f0;
|
||||
background: #1e1f26;
|
||||
background: #232323;
|
||||
}
|
||||
a { color: #60a5fa; }
|
||||
img { opacity: 0.9; }
|
||||
|
||||
Reference in New Issue
Block a user