Commit Graph

27 Commits

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.
2023-03-24 17:42:54 +01:00
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).
2020-12-21 17:05:10 +01:00
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
2020-08-03 11:39:49 +02:00
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.
2020-05-11 19:29:19 +02:00
sharkdp 0064321323 cargo fmt 2020-04-23 00:56:35 +02:00
sharkdp 319ab779ee Use 4-bit ANSI codes for base16 theme
closes #865
2020-04-22 10:22:11 +02:00
David Tolnay 570805bc98 Strip dependencies of bat-as-a-library 2020-03-31 09:27:56 +02:00
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
2020-03-04 23:28:53 +01:00
Mohamad Barbar 3523f60299 Leave blank lines blank terminal output.
Would add some ANSI colour codes previously.
2019-12-15 20:32:02 +01:00
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.
2019-05-08 07:35:43 -05:00
sharkdp a236a9b195 Merge branch 'master' of https://github.com/tskinn/bat into tskinn-master 2018-12-16 20:43:36 +01:00
Nisheet Sinvhal 18d1a3b973 Changed italics to use-italic-text in config
Better placing of italics in help and also added long_help for it
2018-11-04 19:40:05 +01:00
Nisheet Sinvhal e90308e1f8 italics enable|disable working 2018-11-04 19:40:05 +01:00
Taylor 1a6709c2cb add line highlight 2018-10-09 22:25:33 -06:00
Michal Nazarewicz 79b960e17e Use ansi_colours package for better true-colour approximation 2018-09-23 10:19:19 +02:00
sharkdp 9316f2a758 Major refactoring and cleanup 2018-08-22 22:29:12 +02:00
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
2018-08-19 12:32:35 +02:00
Michal Nazarewicz 5c95b8803b Avoid floating point arithmetic in RGB→8-bit ANSI approximation 2018-08-18 20:58:03 +02:00
eth-p 870b3c0daf
PR #102 Followed @BrainMaestro's suggestions
Also ran cargo fmt.
2018-05-13 03:26:23 -07:00
Ethan P bdd10b8bec
Merge branch 'master' into master 2018-05-12 06:40:47 -07:00
eth-p fc160b0dcd
PR #102 Review Changes
- Reformatted code.
- Removed leftover code.
- Removed leftover comments.
- Fixed compiling on Rust 1.24.0
2018-05-12 06:32:23 -07:00
sharkdp cb7b158172 Add bold, italic and underline font styles 2018-05-12 13:23:39 +02:00
eth-p 4e4110bf50
Added line wrapping. 2018-05-11 21:59:26 -07:00
sharkdp 3fa70deaa7 Run 'cargo fmt' and enforce via Travis 2018-05-06 15:10:46 +02:00
Ezinwa Okpoechi d4553c6b38 Add color flag
Colors are disabled if the terminal is not interactive unless explicitly
set otherwise
2018-05-06 14:47:53 +02:00
sharkdp f43409f473 Fix clippy warnings 2018-04-26 07:59:22 +02:00
sharkdp 38762c34d9 Enable 8 bit color support, closes #11 2018-04-23 23:56:47 +02:00