All Projects β†’ ABridoux β†’ lux

ABridoux / lux

Licence: MIT License
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)

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to lux

przm
🎨 A simple, yet feature rich color picker and manipulator
Stars: ✭ 19 (-13.64%)
Mutual labels:  color, command-line-tool
PowerColorLS
PowerShell script to display a colorized directory and file listing with icons
Stars: ✭ 35 (+59.09%)
Mutual labels:  color, command-line-tool
Przm
🎨 A simple, yet feature rich color picker and manipulator
Stars: ✭ 17 (-22.73%)
Mutual labels:  color, command-line-tool
terminal-style
🎨 Return your terminal message in style! Change the text style, text color and text background color from the terminal, console or shell interface with ANSI color codes. Support for Laravel and Composer.
Stars: ✭ 16 (-27.27%)
Mutual labels:  color, command-line-tool
anime-cli
A commandline app for searching about animes, its seasons, number of seasons and airing status.
Stars: ✭ 73 (+231.82%)
Mutual labels:  command-line-tool
harwest-tool
A one-shot tool to harvest submissions from different OJs onto one single VCS managed repository http://bit.ly/harwest
Stars: ✭ 89 (+304.55%)
Mutual labels:  command-line-tool
liszt
Save snippets of information quickly through the command line
Stars: ✭ 15 (-31.82%)
Mutual labels:  command-line-tool
color-rgba
Get rgba array from color string
Stars: ✭ 18 (-18.18%)
Mutual labels:  color
use-smartcrop
React hook for smartcrop.js to content aware image cropping with points of interest and facial recognition.
Stars: ✭ 93 (+322.73%)
Mutual labels:  color
Overwatcheat
Free, open-source undetected color cheat!
Stars: ✭ 180 (+718.18%)
Mutual labels:  color
AppIconSetGen
Tool to generate App Icon set for iOS, macOS, watchOS apps
Stars: ✭ 20 (-9.09%)
Mutual labels:  command-line-tool
gomphotherium
Gomphotherium (/ΛŒΙ‘Ι’mfΙ™ΛˆΞΈΙͺΙ™riΙ™m/; "welded beast"), a command line Mastodon client.
Stars: ✭ 22 (+0%)
Mutual labels:  command-line-tool
kernel-run
Run any Jupyter notebook instantly using Kaggle kernels
Stars: ✭ 59 (+168.18%)
Mutual labels:  command-line-tool
doing-cli
CLI tool to simplify the development workflow on azure devops
Stars: ✭ 19 (-13.64%)
Mutual labels:  command-line-tool
canvas-color-tracker
A utility to track objects on a canvas by unique px color
Stars: ✭ 29 (+31.82%)
Mutual labels:  color
word-color
Finds colors associated with a word, basically https://picular.co/
Stars: ✭ 39 (+77.27%)
Mutual labels:  color
UnityColorPicker
A standalone color picker asset for Unity
Stars: ✭ 70 (+218.18%)
Mutual labels:  color
toml-sort
Toml sorting library
Stars: ✭ 31 (+40.91%)
Mutual labels:  command-line-tool
php-invert-color
Invert a given color.
Stars: ✭ 13 (-40.91%)
Mutual labels:  color
flynt-cli
CLI tool for the WordPress Flynt framework
Stars: ✭ 15 (-31.82%)
Mutual labels:  command-line-tool

Swift package
Swift Package Manager

Install
Mac + Linux

Lux

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 languages:

  • Zsh/Bash
  • Swift (with Splash)
  • Xml
  • Xml enhanced (better visualisation of the tags)
  • Plist
  • Json
  • Yaml

Currently offered themes:

  • Dracula
  • Xcode light (default)
  • Xcode dark

Themes to be added:

  • [] Obsidian
  • [] Tomorrow

You can ask for a language support or a theme by opening an issue. You can also implement a language support if you prefer. The following screenshots show the different usages of Lux.


Plist in macOS app



iOS app with an enhanced XML format



Octory (new) wiki sample



Swift in the terminal



Zsh on iPad. A script from Scripting OSX to notarise a command-line tool.



Zsh in the terminal



Quick example

With the following Plist file

<key>properties</key>
<dict>
    <key>Type</key>
    <string>Input</string>
    <key>InputType</key>
    <string>List</string>
    <key>IsAllowed</key>
    <true/>
</dict>

Here is how the library could inject terminal colors:

\033[38;5;8m<key>\033[39m\033[38;5;161mproperties\033[39m\033[38;5;8m</key>\033[39m
\033[38;5;8m<dict>\033[39m
	\033[38;5;8m<key>\033[39m\033[38;5;161mType\033[39m\033[38;5;8m</key>\033[39m
	\033[38;5;8m<string>\033[39m\033[39mInput\033[39m\033[38;5;8m</string>\033[39m
	\033[38;5;8m<key>\033[39m\033[38;5;161mInputType\033[39m\033[38;5;8m</key>\033[39m
	\033[38;5;8m<string>\033[39m\033[39mList\033[39m\033[38;5;8m</string>\033[39m\
	\033[38;5;8m<key>\033[39m\033[38;5;161mIsAllowed\033[39m\033[38;5;8m</key>\033[39m
\033[38;5;8m<true/>\033[39m\n\033[38;5;8m</dict>\033[39m"

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, & is specified with &amp;, chevrons are written with &lt; for < and &gt; for >. Thus, when using a HTML injector, you can call its function escapingHTML() if you give it plain text as input. Otherwise, nothing has to be done when the input is already HTML encoded.

For the command line tool inject command, the default behavior is to replace those special characters before injecting colors. You can change this behavior with the --no-escape-html flag if you already have a HTML-encoded string as input. To escape those characters, Lux uses the following extension.


How to install it

Homebrew

Use the following command.

brew install ABridoux/formulae/lux

It 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 lux

Lux 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 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

Command-line

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. 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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].