Giter Site home page Giter Site logo

vivid's Introduction

vivid

CICD Crates.io

vivid is a generator for the LS_COLORS environment variable that controls the colorized output of ls, tree, fd, bfs, dust and many other tools.

It uses a YAML configuration format for the filetype-database and the color themes. In contrast to dircolors, the database and the themes are organized in different files. This allows users to choose and customize color themes independent from the collection of file extensions. Instead of using cryptic ANSI escape codes, colors can be specified in the RRGGBB format and will be translated to either truecolor (24-bit) ANSI codes or 8-bit codes for older terminal emulators.

Preview

snazzy molokai ayu
snazzy theme molokai theme ayu theme
lava
lava

Usage

Choose a color theme (for example: molokai). Then, add this to your shells RC file (~/.bashrc, ~/.zshrc, …):

export LS_COLORS="$(vivid generate molokai)"

Theme preview

To try all available themes with your current directory:

for theme in $(vivid themes); do
    echo "Theme: $theme"
    LS_COLORS=$(vivid generate $theme)
    ls
    echo
done

Terminals without true color support

By default, vivid runs in true color mode (24-bit). If you don't have a terminal that supports 24-bit colors, use the --color-mode 8-bit option when running vivid. This will generate interpolated 8-bit colors:

export LS_COLORS="$(vivid -m 8-bit generate molokai)"

Customization

Custom filetypes.yml databases can be placed in /usr/share/vivid, $HOME/.config/vivid, or $XDG_CONFIG_HOME/vivid on POSIX systems, or in %APPDATA%\vivid on Windows systems.

Custom color themes go into a themes subfolder, respectively. You can also specify an explicit path to your custom theme: vivid generate path/to/my_theme.yml. As a starting point, you can use one of the bundled themes.

Installation

On Debian-based systems

Download one of the Debian packages from the release page and install it via dpkg -i:

wget "https://github.com/sharkdp/vivid/releases/download/v0.8.0/vivid_0.8.0_amd64.deb"
sudo dpkg -i vivid_0.8.0_amd64.deb

On Arch Linux

You can install vivid from the official package repository:

pacman -S vivid

On Gentoo Linux

You can install vivid from GURU Overlay

emerge vivid

On FreeBSD

You can install vivid from the FreeBSD Ports Collection:

pkg install vivid

On macOS

You can install vivid from Homebrew:

brew install vivid

Note that the BSD version of ls does not use LS_COLORS, but you can use the GNU version of ls instead:

brew install coreutils
alias ls="gls --color"

On other distributions

Check out the release page for binary builds.

From source

If you have Rust 1.54 or higher, you can install vivid from source via cargo:

cargo install vivid

License

Licensed under either of

at your option.

Useful resources

File types:

ANSI colors:

Similar and related projects:

vivid's People

Contributors

0mp avatar apraga avatar arodriguezcortes avatar babkock avatar chandlerc avatar colinta avatar danielbayley avatar desbma avatar djdv avatar emilygraceseville7cf avatar gillespiecd avatar gseidler avatar ixti avatar jakeanq avatar john-toohey avatar kidonng avatar lordflashmeow avatar menelaos avatar nim65s avatar ormai avatar p00f avatar pedemonte avatar rpdelaney avatar sandalbanditten avatar sharkdp avatar utagai avatar vanillajonathan avatar wolph avatar yavko avatar yochem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vivid's Issues

Cannot generate gruvbox-light, gruvbox-dark

Version information

❯ vivid --version
vivid 0.8.0

Reproduction steps

❯ vivid generate gruvbox-light
❯ vivid generate gruvbox-dark

Expected result

vivid outputs a theme string.

Actual result

❯ vivid generate gruvbox-light
Error: Could not find style for category 'core.reset_to_normal'
❯ vivid generate gruvbox-dark
Error: Could not find style for category 'core.setuid'

brew install failed on mac os ?

Error: No available formula with the name "vivid"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

Output is not deterministic

The output of vivid generate is not deterministic -- subsequent runs differ. Scenarios where the output of Vivid is cached (or used in an idempotent script) could be improved by making the output deterministic.

cargo install missing lava theme

Files end up in ~/.cargo/registry/src/github.com-1ecc6299db9ec823/vivid-0.7.0/themes and are

jellybeans.yml
molokai.yml
one-dark.yml
one-light.yml
snazzy.yml
solarized-dark.yml
solarized-light.yml

I can work around it but seems like github and crates.io do not agree.

Same extension, multiple filetypes

Hello! Love the concept of vivid - big value add in a compact tool.

I was planning to open a PR adding entries in the filetype database for common iOS files, e.g. .pbxproj Xcode project files (and others). While exploring that, however, I realized that .m, the extension for Objective-C implementation files, was already used in the default filetype database for Matlab files.

How will vivid handle the same file extension being associated with multiple filetypes, e.g. if I added an entry for Objective-C files ending in .m? What behavior would we want to see for that kind of conflict?

One workaround would be for me to maintain my own custom filetype database with Matlab removed in favor of ObjC, but since this is a scenario that I can imagine coming up in other scenarios as well I'm curious if this is something you'd like to handle in a specific way. Happy to contribute the changes if there's action to be taken, if that helps.

Thanks in advance!

Configuration doesnt seem to work, pointing at both filetypes.yml or themes/molokai.yml

I may be configuring this incorrectly... but I can't seem to get it to generate a theme based on 'molokai'.

» export VIVID_DATABASE=~/local/share/vivid/themes/molokai.yml
» vivid generate molokai
Error: Unexpected type in YAML file.
» export VIVID_DATABASE=~/local/share/vivid/filetypes.yml
» vivid generate molokai                                 
Error: Could not find theme 'molokai'.

Any ideas?

Zinit plugin permission denied

Installed vivid as a plugin like this

zinit ice as'command' from'gh-r' bpick'*unknown-linux-gnu*' mv'vivid* -> vivid' atload'export LS_COLORS="$(vivid generate molokai)"'
zinit light sharkdp/vivid

it throw out the permission denied error for every zsh initialization
(eval):1: permission denied: vivid

I see vivid binary file need to be installed as root group but why it's a most for a program that changes the colors of tools output

colors odd in readline completion menu when colored-stats set

For readline, if you set the following (in inputrc):

set colored-completion-prefix on
set colored-stats on

Here are the colors (left jellybeans, right nord):
image

The colors for readline completion look odd relative to how colors tend to look elsewhere. nord would probably look fine with a nord terminal theme (matching background), but the jellybeans background is pretty jarring. I don't know anything about the details of how LS_COLORS are defined so I'm not sure if the vivid definition could be improved or if readline is using the LS_COLORS in a strange way.

compilation failure

==> Making package: vivid 0.4.0-1 (Sun 09 Dec 2018 07:39:44 PM GMT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting build()...
   Compiling libc v0.2.44
   Compiling cc v1.0.25
   Compiling unicode-width v0.1.5
   Compiling bitflags v1.0.4
   Compiling strsim v0.7.0
   Compiling vec_map v0.8.1
   Compiling ansi_term v0.11.0
   Compiling linked-hash-map v0.5.1
   Compiling lazy_static v1.2.0
   Compiling yaml-rust v0.4.2
   Compiling term_size v0.3.1
   Compiling atty v0.2.11
   Compiling textwrap v0.10.0
   Compiling ansi_colours v1.0.1
   Compiling clap v2.32.0
   Compiling vivid v0.4.0 (file:///home/kazuhiro/.cache/yay/vivid/src/vivid-0.4.0)
error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
  --> src/error.rs:25:29
   |
25 |     fn fmt(&self, fmt: &mut std::fmt::Formatter) -> result::Result<(), std::fmt::Error>
{
   |                             ^^^

error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
  --> src/error.rs:25:72
   |
25 |     fn fmt(&self, fmt: &mut std::fmt::Formatter) -> result::Result<(), std::fmt::Error>
{
   |                                                                        ^^^

error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
  --> src/error.rs:72:22
   |
72 | pub type Result<T> = std::result::Result<T, VividError>;
   |                      ^^^

error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
  --> src/util.rs:17:17
   |
17 |     opt: Option<std::result::Result<T, E>>,
   |                 ^^^

error[E0658]: access to extern crates through prelude is experimental (see issue #44660)
  --> src/util.rs:18:6
   |
18 | ) -> std::result::Result<Option<T>, E> {
   |      ^^^

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `vivid`.

To learn more, run the command again with --verbose.
==> ERROR: A failure occurred in build().
    Aborting...
Error making: vivid

rust-lang/rust#44660

This happens with both yay -S vivid and cargo install vivid .

Panic when preview output is limited by `head`

Release build straight from the master (340d54a).

$ RUST_BACKTRACE=full vivid preview ansa | head
archives.images: *.vcd
archives.images: *.img
archives.images: *.toast
archives.images: *.bin
archives.images: *.iso
archives.images: *.dmg
archives.other: *.arj
archives.other: *.tbz
archives.other: *.pkg
archives.other: *.tar
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:993:9
stack backtrace:
   0:     0x558fb10278ac - <unknown>
   1:     0x558fb105257f - <unknown>
   2:     0x558fb1021095 - <unknown>
   3:     0x558fb103accd - <unknown>
   4:     0x558fb103a9d3 - <unknown>
   5:     0x558fb103b2cf - <unknown>
   6:     0x558fb1027ce9 - <unknown>
   7:     0x558fb10279fc - <unknown>
   8:     0x558fb103aed2 - <unknown>
   9:     0x558fb103ae8b - <unknown>
  10:     0x558fb103dec0 - <unknown>
  11:     0x558fb0fa3f37 - <unknown>
  12:     0x558fb0f9a1e3 - <unknown>
  13:     0x558fb0f9a1f9 - <unknown>
  14:     0x558fb103b5d4 - <unknown>
  15:     0x558fb0fa58f2 - <unknown>
  16:     0x7f3c7a350d0a - __libc_start_main
  17:     0x558fb0f960aa - <unknown>
  18:                0x0 - <unknown>

New release

Notable changes since v0.4.0:

  • New themes
  • More file extensions
  • Support for character and block devices
  • Ability to specify a path as theme argument

If you find the time, it would be nice to have this out-of-the-box :-)

Standard location for vivid database: $XDG_DATA_HOME?

Hi!

I'm trying to install this on MacOS. I downloaded the darwin version from the release page. Then I moved vivid to /usr/local/bin/vivid and share/vivid to $XDG_DATA_HOME/vivid, which made sense to me because of the share in the original path, which is also in the default for $XDG_DATA_HOME: $HOME/.local/share. I then got this error:

Error: Could not find filetypes database. Make sure that it is located in a standard location. Alternatively, specify the path via the command-line or the VIVID_DATABASE environment variable.

Because the path was not like the two paths specified in the README (which I hadn't read before installing, whoops)

Make sure that you install the contents of the share/vivid folder at /usr/share/vivid or at $HOME/.config/vivid.

My question is, why is the it in /usr/share/ or $HOME/.config (aka xdg config) and not in /usr/share/ or $HOME/.local/share (aka xdg data)?

Think about using a tag-based system (in addition?)

What if a theme-designer decides to colorize in a completely orthogonal way? For example: highlight everything which is Python-related in a specific color/style.

Well, it is possible to do this by highlighting programming.source.python and programming.tooling.packaging.python and programming.tooling.code-style.python with the same style, but maybe it would be nice to be able to just have a single entry in the spirit of CSS-tags (#python { ... }).

Another option would be to allow wild-cards (programming.*.python).

Run vivid on MacOS

Is it possible to run vivid on MacOS?

I installed vivid with cargo, copied filetypes.yml to .config/vivid to avoid the Error: Could not find filetypes database but then adding export LS_COLORS="$(vivid generate molokai)" to .zshrc did nothing, which made me research a bit more and I found out that MacOS uses LSCOLORS and that it doesn't work the same as LS_COLORS so I guess this means that vivid won't run on MacOS, but I thought I should ask.

Create a macOS category for unimportant files

MacOS creates a few files on its directory structure that are generally not meant to be edited (or seen) by regular users. They are usually markers for encoding/translation or settings for window position and configurations. I configure them as unimportant so they don't stand out so much when listing all files in a directory. So far I included on my personal filetypes.yml:
.CFUserTextEncoding
.DS_Store
.localized

Upload .deb to Debian

As you already have a functioning *.deb, would you consider uploading it via https://mentors.debian.net?
Would be great to have vivid available straight from the Debian repositories and there is currently no package with the same name.

Invalid characters in LSCOLORS env var on MacOS Big Sur

This might just be a macOS Big Sur issue, but here's what I'm seeing.

$ uname -a
Darwin paul.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec  2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
  • Installed vivid via Homebrew
  • Using export CLICOLOR=1; in my .bash_profile
$ vivid -V
vivid 0.6.0
$ ls
error: invalid character 'm' in LSCOLORS env var
error: invalid character 'i' in LSCOLORS env var
error: invalid character '=' in LSCOLORS env var
warn: LSCOLORS should use characters a-h instead of 0-9 (see the manual page)
error: invalid character ';' in LSCOLORS env var
error: invalid character '8' in LSCOLORS env var
error: invalid character ';' in LSCOLORS env var
error: invalid character ';' in LSCOLORS env var
error: invalid character ';' in LSCOLORS env var
error: invalid character ';' in LSCOLORS env var
error: invalid character ';' in LSCOLORS env var
error: invalid character '8' in LSCOLORS env var
error: invalid character ';' in LSCOLORS env var
error: invalid character ';' in LSCOLORS env var
...

Please let me know if I can provide any additional information!

Speed

Execution of generate.py is currently quite slow (~60 ms). If we want people to use this in their shells init file, we need to make it fast. So far, it should be pretty easy to rewrite this in Rust.

Better theme- and filetype-db handling

Ideal CLI usage (?):

vivid generate snazzy  # Use default DB, use "snazzy" theme
vivid generate snazzy --db my_filetypes.yml
vivid generate my_theme.yml --db my_filetypes.yml  # Explicitly specify the path to a theme

Themes should be searched in ~/.config/vivid/themes and /usr/share/vivid/themes.

Question regarding using Vivid with Exa

Hello,

I'm curious if there is a way to get the vivid color database (in my case, snazzy) ported through exa so when anyone types "Exa" in a directory Exa's default color scheme runs Vivid's instead. Exa is a more advanced "ls" implementation for those not in the know, and it comes with it's own color scheme/template. You can hardcode an LS_COLORS and/or EXA_COLORS env variables, but idk how to port vivids .yaml color codes into env variable expressions. I suppose vivid works well with Bat & Fd. Curious if it works with exa also..

MacOS X v. 10.15.6
Vivid v.0.5.0
Exa v.0.9.0
Bat v.0.15.4
Fd v.8.1.1
Homebrew 2.4.13-105-gd3e22f4

16-color fallback mode

A fallback to 16 colors would be great for those of us who use a terminal with a set color scheme locally, and rely on true color for unconfigured terminals or over ssh.

[Request] Windows binary release

Could you please provide the Windows binary as well while publishing releases?

Of cause, I could build it myself. But I think we can have the official binary release for Windows, so that package managers like Scoop can create package manifest based on it.

Release is not updated

The one light theme has been added but the release hasn't. Would you mind update the release so that we are able to use it?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.