Skip to content

Syntax highlighting

usql colors the SQL and the meta commands as you type them. It reads each statement in the grammar of the database that it is connected to. A style sets the colors. The default style is monokai.

The same statement in the styles monokai, dracula and catppuccin-mocha, and then with no highlighting.

\? styles lists the names of the styles, and names the style in use. \uset syntax_hl_style changes the style:

\uset syntax_hl_style dracula

To keep a style, put it in the usql section of config.yaml:

usql:
syntax_hl_style: dracula

Configure usql says where config.yaml is.

Setting What it does
syntax_hl turns highlighting on or off
syntax_hl_style the name of the style
syntax_hl_format the number of colors: terminal is 16, terminal256 is 256, terminal16m is 24-bit color, and noop is none
syntax_hl_override_bg when it is true, usql keeps the background color of the terminal and not the background of the style

usql sets syntax_hl_format from what your terminal can show. If the colors look wrong, set it to terminal256 or terminal:

\uset syntax_hl_format terminal256
\uset syntax_hl off

usql turns highlighting off when the terminal shows no color, or when the NO_COLOR environment variable is set.