Commit Graph

27 Commits (6f69682552a46314b5cfbe229ce6da52f14b229a)

Author SHA1 Message Date
Constantin Nickel da3aa4e2fd Use `nu-ansi-term` instead of `ansi_term`
The `nu-ansi-term` crate is a fork of `ansi_term` which is maintained by
the Nushell project.
2 years ago
Mitchell Kember 3099f51ba7 Add ansi theme to replace ansi-light and ansi-dark
This combines ansi-light and ansi-dark into a single theme that works
with both light and dark backgrounds. Instead of specifying white/black,
the ansi theme uses the terminal's default foreground/background color
by setting alpha=01, i.e. #00000001. This is in addition to the alpha=00
encoding where red contains an ANSI color palette number.

Now, `--theme ansi-light` and `--theme ansi-dark` will print a
deprecation notice and use ansi instead (unless the user has a custom
theme named ansi-light or ansi-dark, which would take precedence).
4 years ago
Mitchell Kember f9d5e81f0e Add new theme: base16-256
Bat already has a base16 theme. The new base16-256 theme is for users
of base16-shell, who configure their terminal with a 256-color variant
of a base16 theme. These variants put some of the base16 colors in
elsewhere in the 256-color table to avoid clobbering bright color slots
(ansi codes 8 to 15) with colors that don't respect the ordinary meaning
of that slot (e.g. bright green in ordinary base16 is not green).

For more details, see https://github.com/chriskempson/base16-shell
4 years ago
Mitchell Kember f59d00d4c7 Fix base16, and combine 00 and 0f alpha encodings
This changes the base16 theme back from #RRGGBB0f to #RRGGBB00,
reverting part of #934. That PR used the 0f encoding to produce ANSI
escape sequences 30-37 and 40-47 rather than 38;5 and 48;5 which require
256-color support. Unfortunately, it resulted in base16 using the wrong
colors becuase ansi_term does not support the bright variants (90-97 and
100-107) so it simply mapped them to the non-bright colors.

This PR makes combines the 00 and 0f alpha encodings into 00, and makes
them use the Color enum for the first 8 colors and Fixed otherwise. This
means the ansi-light and ansi-dark themes will work on terminals without
256-color support, and base16 will render bright colors correctly.
4 years ago
sharkdp 0064321323 cargo fmt 5 years ago
sharkdp 319ab779ee Use 4-bit ANSI codes for base16 theme
closes #865
5 years ago
David Tolnay 570805bc98 Strip dependencies of bat-as-a-library 5 years ago
Pavel Aslanov 4021cf8128 Support combination of multiple styles at the same time
Old version of the code did not allowed for `bold italic` or `bold underline` styles
5 years ago
Mohamad Barbar 3523f60299 Leave blank lines blank terminal output.
Would add some ANSI colour codes previously.
5 years ago
Mitchell Kember bb6594e691 Add 3 new themes: ansi-light, ansi-dark, base16
Also, interpret transparent colors (#RRGGBB00) as specifying a terminal
color palette number with RR. The three new themes use this.
5 years ago
sharkdp a236a9b195 Merge branch 'master' of https://github.com/tskinn/bat into tskinn-master 6 years ago
Nisheet Sinvhal 18d1a3b973 Changed italics to use-italic-text in config
Better placing of italics in help and also added long_help for it
6 years ago
Nisheet Sinvhal e90308e1f8 italics enable|disable working 6 years ago
Taylor 1a6709c2cb add line highlight 6 years ago
Michal Nazarewicz 79b960e17e Use ansi_colours package for better true-colour approximation 6 years ago
sharkdp 9316f2a758 Major refactoring and cleanup 6 years ago
sharkdp 2508323264 Extract grid and line-number color from theme
This changes the output color of the grid and the line numbers to use
the "gutter" foreground color defined in the Sublime `.tmTheme` files.

Sublime Text does the same.

Note: we could go one step further and also extract the "GitGutter"
colors from the themes. These could be used instead of red/green/yellow
to signify Git modifications. The problem is that they are quite a bit
harder to extract from the syntect `Theme` object.

closes #178
6 years ago
Michal Nazarewicz 5c95b8803b Avoid floating point arithmetic in RGB→8-bit ANSI approximation 6 years ago
eth-p 870b3c0daf
PR #102 Followed @BrainMaestro's suggestions
Also ran cargo fmt.
6 years ago
Ethan P bdd10b8bec
Merge branch 'master' into master 6 years ago
eth-p fc160b0dcd
PR #102 Review Changes
- Reformatted code.
- Removed leftover code.
- Removed leftover comments.
- Fixed compiling on Rust 1.24.0
6 years ago
sharkdp cb7b158172 Add bold, italic and underline font styles 6 years ago
eth-p 4e4110bf50
Added line wrapping. 6 years ago
sharkdp 3fa70deaa7 Run 'cargo fmt' and enforce via Travis 6 years ago
Ezinwa Okpoechi d4553c6b38 Add color flag
Colors are disabled if the terminal is not interactive unless explicitly
set otherwise
6 years ago
sharkdp f43409f473 Fix clippy warnings 7 years ago
sharkdp 38762c34d9 Enable 8 bit color support, closes #11 7 years ago