Swiftpack.co - Package - ABridoux/lux

Swift package:
Swift Package Manager
Mac + Linux


A Swift library with a dedicated command-line tool to colorise plain code (e.g. for terminal output), HTML files code blocks or attributed strings (e.g. for macOS or iOS apps).

Currently supported:

  • ☑ Xml
  • ☑ Xml enhanced (better visualisation of the tags)
  • ☑ Plist
  • ☑ Json

To be added:

  • ☐ Zsh
  • ☐ Swift

You can ask for a language by opening an issue. The following screenshots show the different usages of Lux.

Output in the terminal with a JSON format

macOS app with a Plist format

iOS app with an enhanced XML format

Octory (new) wiki sample

Quick example

With the following Plist file


Here is how the library could inject terminal colors:


Or Css classes:

<span class="plist-tag">&lt;key&gt;</span><span class="plist-key-name">properties</span><span class="plist-tag">&lt;/key&gt;</span>
<span class="plist-tag">&lt;dict&gt;</span>
    <span class="plist-tag">&lt;key&gt;</span><span class="plist-key-name">Type</span><span class="plist-tag">&lt;/key&gt;</span>
    <span class="plist-tag">&lt;string&gt;</span><span class="plist-key-value">Input</span><span class="plist-tag">&lt;/string&gt;</span>
    <span class="plist-tag">&lt;key&gt;</span><span class="plist-key-name">InputType</span><span class="plist-tag">&lt;/key&gt;</span>
    <span class="plist-tag">&lt;string&gt;</span><span class="plist-key-value">List</span><span class="plist-tag">&lt;/string&gt;</span>
    <span class="plist-tag">&lt;key&gt;</span><span class="plist-key-name">IsAllowed</span><span class="plist-tag">&lt;/key&gt;</span>
    <span class="plist-tag">&lt;true/&gt;</span>
<span class="plist-tag">&lt;/dict&gt;</span>

You can then customise those classes in your CSS file. This wiki page describes each format CSS classes.

Note: For HTML text, the library will take a HTML string as input. In HTML, chevrons are written with &lt; for < and &gt; for >.

How to install it


Use the following command.

brew install ABridoux/formulae/lux

It will download the notarized executable from the latest release.


You can download the latest version of the executable from the releases. Note that the executable is notarized. Also, a notarized lux package is provided.

After having unzipped the file, you can install it if you want to:

install lux /usr/local/bin/ 

Here is a command which downloads the latest version of the program and install it in /usr/local/bin. Run it to download and install the latest version of the program. It erases the current version you may have.

curl -LO https://github.com/ABridoux/lux/releases/latest/download/lux.zip && \
unzip lux.zip && \
rm lux.zip && \
install lux /usr/local/bin && \
rm lux
  • To find all lux versions, please browse the releases page.
  • When deploying a package (with a MDM for example), it might be useful to add the version to the name. To get lux latest version: simply run lux version to get your installed lux version. Also, if you are using scout, you can run curl --silent "https://api.github.com/repos/ABridoux/lux/releases/latest" | scout tag_name to get the latest version available on the Github repository.

Swift package

Start by importing the package in your file Packages.swift.

let package = Package (
    dependencies: [
        .package(url: "https://github.com/ABridoux/lux", from: "0.1.0")

You can then import Lux in a file.

How to use it


Swift package

Special thanks

Thanks to all the contributors of Lux, especially to Damien Rivet who makes code reviews when he has the time. Also, many thanks to the team behind swift-argument-parser who keeps doing an incredible work.



Stars: 2


Used By

Total: 0


FileInjectionService several injectors - 2020-05-28 08:00:59


  • Several Injectors support for FileInjectionService [#26]


  • Injectors language identifiers [#25]
  • XML enhanced closing tag with punctuation [#26]

[Hotfix] Json key names - 2020-05-20 16:44:00

  • Key names with spaces before the : were not properly parsed

Initial release - 2020-05-20 13:49:31

4 data formats:

  • Xml
  • Xml (enhanced)
  • Plist
  • Json

String type

  • plain
  • HTML
  • attributed

CLT commands

  • inject
  • css