Use Operator on Any Website

by Liam Hammett · 3 minute read · #typography #css

Operator is a beautiful monospaced typeface that took the world by storm as it proved that coding typefaces can be both elegant and functional.

One way it helped stand out from the crowd is how certain italic glyphs take inspiration from script typefaces, making them distinct from the ordinary characters.

Improve it again by adding coding ligatures to it with Operator Mono Lig and you’ve got one swish font to code in!

Part of a Vue.js component, shown in Operator Mono Lig, in VS Code

It’s a bit pricier than most typical folk would think of paying for a typeface, at between $200 — $800 depending on the package, but well worth it if you spend all day every day looking at code.

Unfortunately, it’s not something that you’ll typically see when browsing websites, unless they have paid for and implemented the webfont solution themselves. So how can we get more use out of this typeface and see it in other places we typically look at code?


In come User Styles, where browser extensions allow you to add custom CSS to modify the look of a website yourself.

Just change the font-family of all <code> blocks, right?

code {
    font-family: "Operator Mono Lig" !important;
}

That works for the most part, but you still don’t get to see the gorgeous italic characters it offers for most.

Luckily, there are a handful of common Javascript plugins such as Prism, Highlight.js and CodeMirror that websites use to add syntax highlighting to code blocks on them.

These libraries add predictable CSS classes to the code in order to colour them according to the syntax highlighting theme, so luckily we can make use of these to make certain parts of code italic where we want.


If you want to enable this yourself, you can install the user style or get the Gist to use to modify and see what it affects below.

/** General websites **/
code { font-family: "Operator Mono Lig" !important; font-weight: 200; }
pre > code { font-family: "Operator Mono Lig" !important; font-size: 1.2em !important; font-weight: 200; }
/** GitHub **/
.blob-code-inner, .blob-num, .highlight pre { font-family: "Operator Mono Lig" !important; font-weight: 200; }
.pl-c, .pl-e { font-style: italic; }
.pl-c { color: #4CAF50; }
/** Prism JS **/
pre > code .package, pre > code .scope { font-style: italic; }
/** Highlight JS **/
.hljs-doctag, .hljs-title { font-style: italic; }
.hljs-params { font-style: italic; }
.hljs-params .hljs-variable { font-style: normal; }
.hljs-function .hljs-title { font-style: normal; }
.hljs-attribute, .hljs-attr { font-style: italic; }
/** Stack Exchange **/
.typ { font-style: italic; }
/** CodeMirror editors **/
.CodeMirror-line, .CodeMirror-linenumber { font-family: "Operator Mono Lig" !important; font-weight: 200; }
.cm-qualifier { font-style: italic; }

If Operator isn’t quite your style but you want a similar typeface, consider trying Dank Mono instead.

Photo of Liam Hammett

Liam Hammett

Full-stack software developer that loves working with PHP, Laravel and Vue.