Colorize Command

Sunday, February 19, 2023

2:38 PM

Applies colorized syntax highlighting to selected source code. Supported languages include


    • C#
    • C++
    • CSS
    • Go
    • HTML
    • Java
    • JavaScript/JSON
    • PlantUML
    • PowerShell
    • Python
    • SQL
    • Typescript
    • VB
    • Windows Registry
    • Wolfram
    • XML
    • YAML


For best results, first select the text you want to colorize, set the style to Code, and then colorize the selection.



Language selection is done by click the More menu and then the Colorize menu. But there is a faster keyboard shortcut to open the Select Language dialog


Press Alt + C



You can quickly get to a language by typing the first letter of its name and apply syntax highlighting by pressing Enter. Close the dialog and cancel the action by pressing Esc.



The highlighting is not as complete as you might find in VS or VSCode but then OneNote isn't intended to be a programming editor anyway.


The parser will colorize one paragraph at a time. For example, an XML opening tag and its attributes must all appear in one contiguous paragraph or they will be ignored.



  street="123 Main St"

  city="Anytown" />


Since that XML is spread across three separate lines (three paragraphs in OneNote) it will not be recognized as XML. But if it were on a single line, then it will be recognized, such as


<address street="123 Main St" city="Anytown" />


Definition Files

Languages are defined in JSON definition files located below the OneMore installation directory so they can be customized and enhanced and new languages can be added. If you're so inclined to add enhancements or define a new language, please submit a pull request.



#omwiki #omcommands


© 2020 Steven M Cohn. All rights reserved.

Please consider a sponsorship or one-time donation to support ongoing development


Created with OneNote.