json-format-highlight
DEMO
Snapshot
Introduction
Format json and highlight it as well.
A really tiny package, only 652 bytes.
Install
yarn add json-format-highlight --save
CDN: UNPKG | jsDelivr
Usage
import formatHighlight from 'json-format-highlight'
formatHighlight(json, colorOptions)
Option
colorOptions
Type: object
Default: {}
Define your exclusive color scheme :D
You can set the key and types of value of the json to custom colors.
Option | Type | Default | Desc |
---|
keyColor | string | dimgray | Key color |
numberColor | string | lightskyblue | Color of the value of the number type |
stringColor | string | lightcoral | Color of the value of the string type |
trueColor | string | lightseagreen | Color of the value of the boolean type and equals to true |
falseColor | string | #f66578 | Color of the value of the string type and equals to false |
nullColor | string | cornflowerblue | Color of the value of the null type |
License
MIT © luyilin
minemine.cc · GitHub @luyilin · Twitter @luyilin12