ABridoux/lux
A Swift library with a dedicated command-line tool to highlight plain code (e.g. for terminal output), HTML files code blocks or attributed strings (e.g. for macOS or iOS apps)
How to install it
Homebrew
Use the following command.
brew install ABridoux/formulae/luxIt will download the notarized executable from the latest release.
Download
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 luxLux 0.4.3 and later are compatible with Linux. You can download the tar archive "lux-linux" in the releases. In case you got an error regarding "libswiftCore.so" when executing the binary, you can checkout this solution.
Note
- 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 versionto 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.
<br />
How to use it
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. Also, many thanks to John Sundell for his several articles regarding an API development, and for the Splash library as well as all its contributors.
Acknowlegdments
Font used for the logo: Flashlight by Bexxtype]
Contributing
Report a bug
Lux aims to be community project, and anyone is welcome to contribute. As it is still a young project, some bugs may appear, or some text not colorised correctly. If you encounter such problem, please open a issue to describe it and try to add a use case to reproduce the bug. Hopefully, it should be resolved in the following release.
Add a new language or theme
You can read here how to add a new language to Lux. A wiki page explaining theming will be available soon.
Miscellaneous
- Colorize terminal with Swift to colorise the output in the terminal.
- Terminal colors list
- Encode code block to HTML
Package Metadata
Repository: ABridoux/lux
Stars: 30
Forks: 2
Open issues: 7
Default branch: master
Primary language: swift
License: MIT
Topics: color, command-line-tool, swift-package
README: README.md