---
title: "Code diff animated icon"
description: "Code diff animated icon (Developer & version control). A code diff is applied: a removed line is deleted and an added line is confirmed. Light: the line marked minus erases back into its minus like a backspace, the minus kicks as it empties, then the plus pops and settles; the deleted line stays gone. Strong: the minus line erases faster after a short hold, the minus kicks harder, a highlight flashes up behind the added line and fades, and the plus pops bigger and settles in two beats. The preview reset fades the deleted line back in."
canonical: https://generativeicons.com/icons/code-diff/
---

# Code diff animated icon

A code diff is applied: a removed line is deleted and an added line is confirmed. Light: the line marked minus erases back into its minus like a backspace, the minus kicks as it empties, then the plus pops and settles; the deleted line stays gone. Strong: the minus line erases faster after a short hold, the minus kicks harder, a highlight flashes up behind the added line and fades, and the plus pops bigger and settles in two beats. The preview reset fades the deleted line back in.

- Id: `code-diff`
- Category: Developer & version control
- Search terms: diff view, code changes, lines changed, additions and deletions, added and removed, unified diff, git diff, compare code, delta, changes
- Two states: prepared to result, played forward and back
- Styles: outline, solid, duotone; outline weights 1.5, 2, 2.5 (any from 1 to 3); motion light or strong
- File: https://generativeicons.com/assets/code-diff.lottie (dotLottie, 6888 bytes, sha256 159443fe4444d2d661cde64442bdf65da6bb200a34cf0ab929e0e5b2d5c73d55)
- License: MIT

## Install

```sh
npm install @lottiefiles/generative-icons-runtime
npx generative-icons init
npx generative-icons add code-diff
```

## React

```tsx
// npm install @lottiefiles/generative-icons-react
'use client';
import { AnimatedIcon } from '@lottiefiles/generative-icons-react';
import icon, { src } from './generative-icons/code-diff.mjs';

export function CodeDiffIcon() {
  return <AnimatedIcon icon={icon} src={src} size={32}
    color="#ffffff" variant="outline" weight={2}
    motion="light" theme="dark" />;
}
```

## JavaScript

```js
import { createIcon } from '@lottiefiles/generative-icons-runtime';
import icon, { src } from './generative-icons/code-diff.mjs';

const handle = await createIcon(canvas, {
  icon, src,
  color: '#ffffff', style: 'outline', weight: 2,
  motion: 'light', theme: 'dark'
});
button.addEventListener('click', () => handle.play());
// On removal: handle.destroy();
```

More: https://generativeicons.com/icons/code-diff/ · https://generativeicons.com/api/icons/code-diff
