# klor

> syntax highlighting

Latest version **2.17.0** (published 2021-12-02) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install klor
pnpm add klor
yarn add klor
bun add klor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.17.0 |
| Published | 2021-12-02 |
| First published | 2019-05-11 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 276 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | monsterkodi |
| Maintainers | monsterkodi |
| Keywords | syntax, highlighting |

## Links

- npm: https://www.npmjs.com/package/klor
- Repository: https://github.com/monsterkodi/klor
- Homepage: https://www.npmjs.com/package/klor
- Issues: https://github.com/monsterkodi/klor/issues
- npm.io page: https://npm.io/package/klor

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 2.17.0 (latest) — 2021-12-02
- 2.16.1 — 2021-02-27
- 2.16.0 — 2021-02-27
- 2.15.0 — 2021-02-23
- 2.14.0 — 2021-02-23
- 2.13.0 — 2020-12-15
- 2.12.0 — 2020-12-01
- 2.11.0 — 2020-06-25
- 2.10.0 — 2020-06-25
- 2.8.0 — 2020-03-08
- 2.7.0 — 2020-03-07
- 2.6.0 — 2020-03-02
- 2.5.0 — 2020-03-02
- 2.4.0 — 2020-01-30
- 2.3.0 — 2020-01-09
- … 50 more at https://npm.io/package/klor/versions

## README

![klor](test/sample.png)

**klor** is a simple syntax highlighting tool.
It exports the following function:

### **parse** *lines*, *ext*

- *lines*: array of strings
- *ext*: file type
    - coffee js ts 
    - styl css sass
    - pug html svg 
    - bash fish sh 
    - cpp hpp c h 
    - noon json
    - md plist 
    
**returns** an array of objects:

```coffeescript
[
    ext:    string              
    chars:  number              
    index:  number              
    number: index+1 
    chunks: [
                match:  string  # without whitespace characters
                clss:   string  # value of match
                turd:   string  # following punctuation characters
                start:  number  # character index of match in line
                length: number  # length of match
            ]
...
]
```

See [kolor.map](https://github.com/monsterkodi/klor/blob/master/coffee/kolor.coffee) for a list of recognized chunk values.

## 🌈 kolor

**kolor** is a submodule which exports a bunch of functions for wrapping strings in 256 color ansi codes.

It's a merge of [colorette](https://github.com/jorgebucaran/colorette) and [ansi-256-colors](https://github.com/jbnicolai/ansi-256-colors)

- [r g b c m y w][1..8] foreground colors 
- [R G B C M Y W][1..8] background colors
    
```coffeescript
klor = require 'klor'
klor.kolor.globalize() # hoist color functions into the global scope
log y8 'bright yellow' + R1 'on dark red'
```

[![npm package][npm-image]][npm-url] 
[![Build Status][travis-image]][travis-url] 
[![downloads][downloads-image]][downloads-url] 

[npm-image]:https://img.shields.io/npm/v/klor.svg
[npm-url]:http://npmjs.org/package/klor
[travis-image]:https://travis-ci.org/monsterkodi/klor.svg?branch=master
[travis-url]:https://travis-ci.org/monsterkodi/klor
[downloads-image]:https://img.shields.io/npm/dm/klor.svg
[downloads-url]:https://www.npmtrends.com/klor

---
_Source: https://npm.io/package/klor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
