Skip to content
CDGet
  • Home
  • Projects
  1. Home
  2. All projects
  3. Diffine

Diffine

Library

A diff engine and a side-by-side viewer for text and for pictures, shipped as a React library and a Flutter package. It matches two versions line by line and then word by word inside the lines that changed, compares two images pixel by pixel, and draws the result with the two sides held level, so an application does not have to build the comparison or the alignment itself.

Homepage (opens in a new tab)Documentation (opens in a new tab)Source code (opens in a new tab)

About this project

Diffine works out what changed between two versions and puts it on the screen, for text and for pictures, in React and in Flutter. The comparison and the view are one library rather than a diff package with a viewer bolted on top, and the two halves meet at a value: diffText returns rows, changes and counts, and diffImage returns a mask, the changed regions as rectangles and the counts, with no component or widget anywhere in either. The viewer is one consumer of that value rather than the only way to reach it, so the same comparison can be printed in a terminal, run in a worker or checked against a threshold in a build. A unified patch is a comparison too: parsePatch reads one into the same value, and formatPatch writes one back out.

Text is matched at two levels in a single pass. Lines are paired first, and then, inside a pair that was edited rather than replaced, the words or the characters that actually moved. The viewer draws that across two panes held level with each other, with connectors over the gap, and every part of the view is a setting with a default: line numbers, wrapping, the alignment, the connectors, the unified layout, and folding away the lines nobody edited. An editor mode lays a field over each pane and works the comparison out again on every keystroke. Pictures are compared side by side, faded over each other, wiped across, or as the mask alone, with a tolerance, smoothing left by a renderer ignored, and an offset found between two shots that are not lined up; diffImages compares more than two at once, and imageSimilarity answers with a single number. Reading it without a mouse works, because each pane is a region that takes focus, the buttons that step from one change to the next are labelled, and what changed is announced as soon as it moves.

Setup is the package and one line of CSS on the web, and one import in Flutter. Each package has one dependency: React adds highlight.js for syntax highlighting, loaded one grammar at a time through a dynamic import so that a plain-text comparison downloads none of it, and Flutter adds characters, which Flutter already ships. react and react-dom are peer dependencies, so the copies the application already has are the ones Diffine uses. The two packages share the engine and the palette down to the colour values, and the dark theme follows the system setting. The React package is ESM with TypeScript declarations, and its root is the engine alone, with the viewers under diffine-react/text-diff and diffine-react/image-diff, so an application that only wants the comparison does not pull a viewer along with it.

Features

  • Documentation site

  • TypeScript types

  • Multiple languages

  • Verified by tests

  • Cross-platform

  • Accessibility built in

  • Dark mode

  • Tree-shakeable

Project information

Started
2026
License
MIT (opens in a new tab)
Programming languages
DartJavaScript
Tags
diffdiff-viewertext-diffimage-diffreactflutter
Packages
diffine-react (opens in a new tab)npmdiffine (opens in a new tab)pub.dev
Popularity
3
GitHub stars
83
npm downloads
Data points: 30. Range: 0 to 24.
Diffine — npm downloads, Last 30 days
npm downloads
Sep 2324
Sep 242
Sep 250
Sep 260
Sep 277
Sep 281
Sep 293
Sep 301
Oct 12
Oct 21
Oct 30
Oct 41
Oct 52
Oct 60
Oct 73
Oct 84
Oct 95
Oct 101
Oct 115
Oct 123
Oct 130
Oct 140
Oct 150
Oct 1613
Oct 170
Oct 183
Oct 190
Oct 200
Oct 210
Oct 222
Last 30 days
ContactDonate
The projects listed here are open source under the MIT License.© 2026 CDGet. All rights reserved.