mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-26 12:35:14 +03:00
Remove ui::style::ColorDef in favor up tui::style::Color (#391)
Closes #149.
This commit is contained in:
parent
d0f59fa0bf
commit
21b7513f48
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1282,6 +1282,7 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
"cassowary",
|
"cassowary",
|
||||||
"crossterm 0.17.7",
|
"crossterm 0.17.7",
|
||||||
|
"serde",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
@ -23,7 +23,7 @@ scopetime = { path = "./scopetime", version = "0.1" }
|
|||||||
asyncgit = { path = "./asyncgit", version = "0.10" }
|
asyncgit = { path = "./asyncgit", version = "0.10" }
|
||||||
crossterm = { version = "0.18", features = [ "serde" ] }
|
crossterm = { version = "0.18", features = [ "serde" ] }
|
||||||
clap = { version = "2.33", default-features = false }
|
clap = { version = "2.33", default-features = false }
|
||||||
tui = { version = "0.12", default-features = false, features = ['crossterm'] }
|
tui = { version = "0.12", default-features = false, features = ['crossterm', 'serde'] }
|
||||||
bytesize = { version = "1.0.1", default-features = false}
|
bytesize = { version = "1.0.1", default-features = false}
|
||||||
itertools = "0.9"
|
itertools = "0.9"
|
||||||
rayon-core = "1.9"
|
rayon-core = "1.9"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Themes
|
# Themes
|
||||||
|
|
||||||
default on light terminal:
|
default on light terminal:
|
||||||
![](assets/light-theme.png)
|
![](assets/light-theme.png)
|
||||||
@ -10,5 +10,4 @@ to change the colors of the program you have to modify `theme.ron` file
|
|||||||
* `$XDG_CONFIG_HOME/gitui/theme.ron` (linux using XDG)
|
* `$XDG_CONFIG_HOME/gitui/theme.ron` (linux using XDG)
|
||||||
* `$HOME/.config/gitui/theme.ron` (linux)
|
* `$HOME/.config/gitui/theme.ron` (linux)
|
||||||
|
|
||||||
Valid colors can be found in [ColorDef](./src/ui/style.rs#ColorDef) struct. note that rgb colors might not be supported
|
Valid colors can be found in tui-rs' [Color](https://docs.rs/tui/0.12.0/tui/style/enum.Color.html) struct. note that rgb colors might not be supported in every terminal.
|
||||||
in every terminal.
|
|
||||||
|
@ -18,35 +18,34 @@ pub type SharedTheme = Rc<Theme>;
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct Theme {
|
pub struct Theme {
|
||||||
#[serde(with = "ColorDef")]
|
|
||||||
selected_tab: Color,
|
selected_tab: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
command_fg: Color,
|
command_fg: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
selection_bg: Color,
|
selection_bg: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
cmdbar_extra_lines_bg: Color,
|
cmdbar_extra_lines_bg: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
disabled_fg: Color,
|
disabled_fg: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
diff_line_add: Color,
|
diff_line_add: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
diff_line_delete: Color,
|
diff_line_delete: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
diff_file_added: Color,
|
diff_file_added: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
diff_file_removed: Color,
|
diff_file_removed: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
diff_file_moved: Color,
|
diff_file_moved: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
diff_file_modified: Color,
|
diff_file_modified: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
commit_hash: Color,
|
commit_hash: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
commit_time: Color,
|
commit_time: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
commit_author: Color,
|
commit_author: Color,
|
||||||
#[serde(with = "ColorDef")]
|
#[serde(with = "Color")]
|
||||||
danger_fg: Color,
|
danger_fg: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,29 +265,3 @@ impl Default for Theme {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// we duplicate the Color definition from `tui` crate to implement Serde serialisation
|
|
||||||
/// this enum can be removed once [tui-#292](https://github.com/fdehau/tui-rs/issues/292) is resolved
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Copy, Clone)]
|
|
||||||
#[serde(remote = "Color")]
|
|
||||||
enum ColorDef {
|
|
||||||
Reset,
|
|
||||||
Black,
|
|
||||||
Red,
|
|
||||||
Green,
|
|
||||||
Yellow,
|
|
||||||
Blue,
|
|
||||||
Magenta,
|
|
||||||
Cyan,
|
|
||||||
Gray,
|
|
||||||
DarkGray,
|
|
||||||
LightRed,
|
|
||||||
LightGreen,
|
|
||||||
LightYellow,
|
|
||||||
LightBlue,
|
|
||||||
LightMagenta,
|
|
||||||
LightCyan,
|
|
||||||
White,
|
|
||||||
Rgb(u8, u8, u8),
|
|
||||||
Indexed(u8),
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user