Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
a syntax highligher in JavaScript with JSON grammars
CoffeeScript Ruby JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
src
test
themes
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.styl
package.json

README.md

Stratus:Color

Build Status

It works from the command line, or the browser, and is used by Stratus Editor.

Syntax languages are installed using stratus-bundle.

Install

Be sure you have stratus-bundle.

npm install -g stratus-color

CLI

Writes highlighted version of somefile.rb to ./somefile.rb.html, including the CSS for the theme.

$ stratus-color --file somefile.rb -s

Writes highlighted version of somefile.rb to ./somefile.rb.html, without the CSS for the theme.

$ stratus-color --file somefile.rb

The code can be passed via STDIN instead.

$ echo 'def hi()\n  true\nend' | stratus-color -l Ruby

API

color(text, rules, context)

Highlight a string

color = require 'stratus-color'

code = """def hello()
  puts "Hello, world"
end"""

color code, "Ruby"
# =>
# "<div>... the highlighted code ...</div>"

color code, "Ruby", format: "json"
# =>
# [ [... list of tokens for line 0 ...]
# , [... line 1 ...]
# , [...]
# ]

color.file(path, options?, callback)

Highlight a file

color.file "path/to/file.rb", (err, html) ->
  # ...

List of syntaxes

Writing syntaxes

License

See LICENSE.

Something went wrong with that request. Please try again.