| Crates.io | lumis |
| lib.rs | lumis |
| version | 0.1.0 |
| created_at | 2026-01-08 14:01:55.606104+00 |
| updated_at | 2026-01-23 21:34:17.862788+00 |
| description | Syntax highlighter powered by Tree-sitter and Neovim themes. |
| homepage | https://lumis.sh |
| repository | https://github.com/leandrocp/lumis |
| max_upload_size | |
| id | 2030278 |
| size | 139,634,994 |
Lumis is a syntax highlighter powered by Tree-sitter and Neovim themes. It provides beautiful and accurate syntax highlighting for over 70 programming languages with support for over 100 themes.
Add Lumis to your Cargo.toml:
[dependencies]
lumis = "0.1"
By default, Lumis includes support for all languages, which can result in longer compilation times. You can reduce compilation time and binary size by enabling only the languages you need:
[dependencies]
lumis = { version = "0.1", default-features = false, features = ["lang-rust", "lang-javascript", "lang-python"] }
Available language features:
lang-angular - Angular templateslang-asm - Assemblylang-astro - Astro frameworklang-bash - Bash/Shell scriptslang-c - C programming languagelang-caddy - Caddylang-clojure - Clojurelang-cmake - CMake build fileslang-comment - Comment highlightinglang-commonlisp - Common Lisplang-cpp - C++lang-csharp - C#lang-css - CSS stylesheetslang-csv - CSV fileslang-dart - Dartlang-diff - Diff/patch fileslang-dockerfile - Docker fileslang-eex - Elixir EEx templateslang-ejs - EJS templateslang-elixir - Elixirlang-elm - Elmlang-erb - ERB templateslang-erlang - Erlanglang-fish - Fishlang-fsharp - F#lang-gleam - Gleamlang-glimmer - Glimmer/Handlebarslang-go - Golang-graphql - GraphQLlang-haskell - Haskelllang-hcl - HCL/Terraformlang-heex - Phoenix HEEx templateslang-html - HTMLlang-iex - Elixir IExlang-java - Javalang-javascript - JavaScriptlang-json - JSONlang-kotlin - Kotlinlang-latex - LaTeXlang-liquid - Liquid templateslang-llvm - LLVM IRlang-lua - Lualang-make - Makefileslang-markdown - Markdownlang-markdown-inline - Inline Markdownlang-nix - Nixlang-objc - Objective-Clang-ocaml - OCamllang-ocamlinterface - OCaml Interfacelang-perl - Perllang-php - PHPlang-plaintext - Plain Textlang-powershell - PowerShelllang-protobuf - Protocol Bufferslang-python - Pythonlang-r - Rlang-regex - Regular expressionslang-ruby - Rubylang-rust - Rustlang-scala - Scalalang-scss - SCSSlang-sql - SQLlang-surface - Phoenix Surfacelang-svelte - Sveltelang-swift - Swiftlang-toml - TOMLlang-tsx - TypeScript JSXlang-typescript - TypeScriptlang-typst - Typstlang-vim - Vim scriptlang-vue - Vue.jslang-xml - XMLlang-yaml - YAMLlang-zig - ZigOr use the convenience feature to enable all languages:
[dependencies]
lumis = { version = "0.1", features = ["all-languages"] }
Install the lumis command-line tool:
cargo install lumis
For faster compilation, you can install the CLI with only the languages you need:
# Install with only specific languages
cargo install lumis --no-default-features --features "lang-rust,lang-python,lang-javascript"
# Install with web development languages
cargo install lumis --no-default-features --features "lang-html,lang-css,lang-javascript,lang-typescript,lang-json"
# Install with all languages (same as default)
cargo install lumis --features "all-languages"
This can significantly reduce compilation time, especially on slower machines or CI environments.
use lumis::{highlight, Options};
let code = r#"
function greet(name) {
console.log(`Hello ${name}!`);
}
"#;
let html = highlight("javascript", code, Options::default());
use lumis::{highlight, Options, themes::Theme};
let code = "SELECT * FROM users WHERE active = true;";
// Parse theme from string
let theme: Theme = "dracula".parse().expect("Theme not found");
// Or: let theme = themes::get("dracula").expect("Theme not found");
let html = highlight(
"sql",
code,
Options {
theme,
..Options::default()
}
);
use lumis::{highlight, Options};
let code = r#"
defmodule MyApp do
def hello, do: :world
end
"#;
// Language will be automatically detected as Elixir from the .ex extension
let html = highlight("app.ex", code, Options::default());
use lumis::{highlight, Options, FormatterOption};
let code = "puts 'Hello from Ruby!'";
let ansi = highlight(
"ruby",
code,
Options {
formatter: FormatterOption::Terminal,
..Options::default()
}
);
use lumis::{highlight, Options, FormatterOption};
let code = "console.log('Hello!')";
let html = highlight(
"javascript",
code,
Options {
formatter: FormatterOption::HtmlLinked,
..Options::default()
}
);
When using FormatterOption::HtmlLinked, include the corresponding CSS file for your chosen theme:
<link rel="stylesheet" href="css/dracula.css" />
The lumis command-line tool provides several commands for syntax highlighting and code analysis:
lumis list-languages
Lists all supported programming languages and their associated file patterns.
lumis list-themes
Lists all available syntax highlighting themes.
lumis highlight <path> [options]
Highlights the contents of a file with syntax highlighting.
Options:
-f, --formatter <formatter>: Output format (default: terminal)
terminal: ANSI colored output for terminalhtml-inline: HTML output with inline styleshtml-linked: HTML output with linked stylesheet-t, --theme <theme>: Theme name (default: catppuccin_frappe)Example:
lumis highlight src/main.rs --formatter html-inline --theme github_dark
lumis highlight-source <source> [options]
Highlights a string of source code.
Options:
-l, --language <language>: Programming language for the source code-f, --formatter <formatter>: Output format (default: terminal)-t, --theme <theme>: Theme name (default: catppuccin_frappe)Example:
lumis highlight-source "println!(\"Hello World!\");" -l rust
lumis dump-tree-sitter <path>
Dumps the Tree-sitter AST (Abstract Syntax Tree) for a given file. This is useful for debugging or understanding how Tree-sitter parses your code.
lumis gen-theme --url <git-url> --colorscheme <name> [options]
Generates a theme JSON file from any Git repository containing a Neovim theme.
Note: Requires nvim to be installed and available in $PATH.
Required options:
--url <git-url>: Git repository URL (e.g., https://github.com/catppuccin/nvim)--colorscheme <name>: Colorscheme name to activate (e.g., catppuccin-mocha)Optional:
--setup <lua-code>: Custom Lua setup code to run before activating the colorscheme-o, --output <path>: Output file path (prints to stdout if not specified)--appearance <light|dark>: Theme appearance (defaults to dark)Examples:
# Basic usage - output to stdout
lumis gen-theme --url https://github.com/catppuccin/nvim --colorscheme catppuccin-mocha
# Save to file
lumis gen-theme \
--url https://github.com/folke/tokyonight.nvim \
--colorscheme tokyonight \
-o tokyonight.json
# With custom setup code
lumis gen-theme \
--url https://github.com/ellisonleao/gruvbox.nvim \
--colorscheme gruvbox \
--setup "require('gruvbox').setup({ contrast = 'hard' })" \
-o gruvbox-hard.json
# Specify light appearance
lumis gen-theme \
--url https://github.com/projekt0n/github-nvim-theme \
--colorscheme github_light \
--appearance light \
-o github-light.json
See themes/README.md for more details on theme generation.
Check the documentation for a complete list of supported languages and file extensions.
Lumis includes over 100 themes, such as:
Check the documentation for a complete list of supported themes.
If you were using the autumnus crate, simply update your dependencies:
# Before
[dependencies]
autumnus = "0.8"
# After
[dependencies]
lumis = "0.1"
And update your imports:
// Before
use autumnus::*;
// After
use lumis::*;
The API remains the same.
Contributions are welcome! Feel free to:
Lumis would not be possible without these projects: