Move line styles to theme

This commit is contained in:
Silvano Cerza 2025-03-06 17:12:10 +01:00
parent 46186d8d23
commit d8ebee26e8

View file

@ -4,20 +4,6 @@ import { Decoration, EditorView } from "@codemirror/view";
import diff, { DiffChunk } from "./diff";
const styles = document.createElement("style");
styles.innerHTML = `
.cm-changedLine {
background-color: rgba(var(--color-yellow-rgb), 0.1);
}
.cm-addedLine {
background-color: rgba(var(--color-green-rgb), 0.1);
}
.cm-deletedLine {
background-color: rgba(var(--color-red-rgb), 0.1);
}
`;
document.head.appendChild(styles);
interface UnifiedDiffViewProps {
initialOldText: string;
initialNewText: string;
@ -281,6 +267,15 @@ const UnifiedDiffView: React.FC<UnifiedDiffViewProps> = ({
"&.cm-focused .cm-cursor": {
borderLeftColor: "var(--text-normal)",
},
".cm-changedLine": {
backgroundColor: "rgba(var(--color-yellow-rgb), 0.1)",
},
".cm-addedLine": {
backgroundColor: "rgba(var(--color-green-rgb), 0.1)",
},
".cm-deletedLine": {
backgroundColor: "rgba(var(--color-red-rgb), 0.1)",
},
}),
];
}, [initialOldText, initialNewText]);