1extern crate ansi_colours;
3use ansi_term::Colour::{Fixed, RGB};
4use ansi_term::{self, Style};
6use syntect::highlighting::{self, FontStyle};
8pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term::Colour {
10 RGB(color.r, color.g, color.b)
12 Fixed(ansi_colours::ansi256_from_rgb((color.r, color.g, color.b)))
16pub fn as_terminal_escaped(
17 style: highlighting::Style,
22 let style = if !colored {
25 let color = to_ansi_color(style.foreground, true_color);
27 if style.font_style.contains(FontStyle::BOLD) {
29 } else if style.font_style.contains(FontStyle::UNDERLINE) {
31 } else if style.font_style.contains(FontStyle::ITALIC) {
38 style.paint(text).to_string()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list