Permalink
Browse files

Add 'source-highlight-solarized/' from commit 'e523deb834eb58fc93a524…

…3f37b7f6908c0b9cae'

git-subtree-dir: source-highlight-solarized
git-subtree-mainline: b0e2164
git-subtree-split: e523deb
  • Loading branch information...
2 parents b0e2164 + e523deb commit ff697910f0fff4df0eea0360af8a1f3397a07d8c Dmitrijs Ledkovs committed Feb 27, 2012
View
78 source-highlight-solarized/README.md
@@ -0,0 +1,78 @@
+source-highlight-solarized
+==========================
+
+**NOTE:** This is seriously a work in progress. It's not done. If you want it
+to get done, please contribute!
+
+A set of [Solarized][1] .style and .outlang files for [GNU Source-highlight][1]. I
+made this parimarily for pretty source highlighting when using [less][2]. See
+below for less-specific instructions.
+
+[1]: http://ethanschoonover.com/solarized
+[2]: http://www.gnu.org/software/src-highlite/
+[3]: http://en.wikipedia.org/wiki/Less_(Unix)
+
+
+Installation
+------------
+1. Install Source-highlight using your preferred method (build it yourself
+ [according to the manual][3] or use a package manager, e.g. `apt-get
+ install source-highlight` or `brew install source-highlight`).
+
+2. Run `source-highlight-settings`. This will tell you where your *datadir* is
+ and give you a chance to change it (you won't need to, but note the path).
+
+3. You have two options now:
+ 1. Copy (or symbolic link) the \*-solarized.style and \*-solarized.outfile
+ files to *datadir* and invoke them manually with Source-highlight's `-f`
+ and `--style-file` options (a good option if you're only going to use
+ Source-highlight with less.
+
+ 2. Overwrite the old files, e.g. copy `esc-solarized.style` over
+ `esc.style` and `esc-solarized.outlang` over `esc.lang` (or remove the
+ original files and symlink the solarized files).
+
+[4]: http://www.gnu.org/software/src-highlite/source-highlight.html#Installation
+
+
+Using with less
+---------------
+To automatically Source-highlight files when using less, just add the following
+lines to your `.bashrc`:
+
+ export LESSOPEN="| source-highlight -f esc-solarized --style-file=esc-solarized.style -i %s -o STDOUT"
+ export LESS=" -R "
+
+Or, if you overwrote/removed the original `*.style` and `*.outlang` files:
+
+ export LESSOPEN="| source-highlight -f esc -i %s -o STDOUT"
+ export LESS=" -R "
+
+Now use less as usual and supported files will be highlighted.
+
+
+Extras
+------
+Look in `extras/` for an updated `ruby.lang` file, because Source-highlight's
+original was sorely lacking. Copy or symlink this to *datadir* just like the
+other files. The included file still needs work. Feel free to...
+
+
+CONTRIBUTE!
+-----------
+I'm a noob with Source-highlight. Any help would be appreciated. See the
+[Source-highlight docs][4] for information on its lang, outlang, and
+style syntaxes.
+
+[5]: http://www.gnu.org/software/src-highlite/source-highlight.html
+
+
+TODO
+----
+* Implement light as well as dark color schemes.
+* Figure out the correct ANSI codes for bold/italic on the terminal and how to
+ use them in `esc-solarized.outlang`.
+* Implement other `*.outlang` files.
+* Make it as pretty as [vim-colors-solarized][5] in as many cases as possible.
+
+[6]: https://github.com/altercation/vim-colors-solarized
View
22 source-highlight-solarized/esc-solarized.outlang
@@ -0,0 +1,22 @@
+extension "txt"
+
+styletemplate "[38;05;$stylem$text"
+styleseparator ";"
+
+# TODO: Make these work
+bold "01$style"
+underline "04$style"
+italics "$style"
+color "$style"
+
+colormap
+"yellow" "136"
+"orange" "166"
+"red" "160"
+"darkred" "125"
+"purple" "61"
+"blue" "33"
+"cyan" "37"
+"green" "64"
+default "241"
+end
View
58 source-highlight-solarized/esc-solarized.style
@@ -0,0 +1,58 @@
+// SOLARIZED XTERM
+// --------- -----
+// base03 234
+// base02 235
+// base01 240
+// base00 241
+// base0 244
+// base1 245
+// base2 254
+// base3 230
+// yellow 136
+// orange 166
+// red 160
+// magenta 125
+// violet 61
+// blue 33
+// cyan 37
+// green 64
+
+normal "244" ;
+keyword "245" ;
+type yellow ;
+classname yellow ;
+constant yellow ;
+string cyan ;
+regexp cyan ;
+specialchar red ;
+comment "240" ;
+number cyan ;
+preproc orange ;
+symbol "244" ;
+function blue ;
+cbracket "244";
+variable blue ;
+todo bg:cyan ;
+
+// line numbers
+linenum yellow;
+
+// other elements for ChangeLog and Log files
+date cyan ;
+time blue ;
+ip green ;
+file blue ;
+name green ;
+
+// Internet related
+url blue ;
+
+// for diffs
+oldfile orange;
+newfile green;
+difflines blue;
+
+// for css
+selector purple;
+property blue;
+value green ;
View
37 source-highlight-solarized/extras/ruby.lang
@@ -0,0 +1,37 @@
+preproc = "require"
+
+include "number.lang"
+
+string delim "\"" "\"" escape "\\"
+string delim "'" "'" escape "\\"
+string delim "<" ">"
+
+# TODO: Figure out how to highlight Ruby :symbols correctly
+# string delim ":" '[[:word:]]?(?:[^[:word:]])'
+
+regexp = '/[^\n]*/'
+(symbol,regexp) = `(%r)(\{(?:\\\}|#\{[[:alnum:]]+\}|[^}])*\})`
+
+constant = '[A-Z][[:word:]]*' # There's probably a better regex for this
+keyword = "alias|begin|BEGIN|break|case|defined|do|else|elsif|end|END|ensure|for|if|in|include|loop|next|raise|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|false|nil|self|true|__FILE__|__LINE__|and|not|or|def|class|module|catch|fail|load|throw"
+
+comment delim '(^\=begin)' '^(\=end)' multiline
+
+type = '(\$[#]?|@@|@)([[:word:]]+|\'|\"|/)'
+
+# don't highlight ? and ! as symbols if they are part of a method call
+normal = '[[:alnum:]]+(\?|!)'
+
+include "symbols.lang"
+
+# for variable interpolation, #{ is not a comment
+(symbol,cbracket) = `(#)(\{)`
+
+include "script_comment.lang"
+
+cbracket = "{|}"
+
+# no function highlighting for Ruby, since a method invocation
+# can be written even without parenthesis
+# include "function.lang"
+

0 comments on commit ff69791

Please sign in to comment.