Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Latest commit

 

History

History
49 lines (34 loc) · 1.47 KB

README.md

File metadata and controls

49 lines (34 loc) · 1.47 KB

@npmcli/disparity-colors

NPM version Build Status License

Spiritual sucessor to disparity. Colorizes Diff Unified format output using ansi-styles.

Install

npm install @npmcli/disparity-colors

Usage:

const colorize = require('@npmcli/disparity-colors')
mapWorkspaces(`--- a/src/index.js
+++ b/src/index.js
@@ -1,4 +1,5 @@
 "use strict";
+"use foo";

 const os = require("os");
`)
// �[33m--- a/src/index.js�[39m
// �[33m+++ b/src/index.js�[39m
// �[35m@@ -1,4 +1,5 @@�[39m
// "use strict";
// �[32m+"use foo";�[39m
// 
// const os = require("os");

API:

colorize(str, opts = {}) -> String

  • str: A Diff Unified format string
  • opts:
    • headerLength: A Number defining how many lines should be colorized as header

Returns

A String including the appropriate ANSI escape codes

LICENSE

ISC