Skip to content

Instantly share code, notes, and snippets.

@fxfactorial
Last active November 10, 2015 16:53
Show Gist options
  • Save fxfactorial/71e9a695d9209c6e59be to your computer and use it in GitHub Desktop.
Save fxfactorial/71e9a695d9209c6e59be to your computer and use it in GitHub Desktop.
Use node and node packages, like npm's color.js, from OCaml
let () =
let styled =
Colors_js.colorize ~msg:"Hello World"
~styles:Colors_js.([Blue; Underline; White_bg])
[]
in
let with_actions =
Colors_js.colorize ~msg:"Foo Bar Baz" ~styles:[] [Colors_js.America]
in
print_endline styled;
print_endline with_actions
@fxfactorial
Copy link
Author

Compile and use with

$ ocamlfind ocamlc c_text.ml -linkpkg -package colors_js -o T.out 
$ js_of_ocaml T.out
$ node T.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment