summaryrefslogtreecommitdiffstats
path: root/src/style.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-05-22 15:21:10 -0400
committerDan Davison <dandavison7@gmail.com>2020-05-22 22:45:47 -0400
commitac64b1236bb85cb693b71a0d3552bff1d298da22 (patch)
tree9ffe16c979361a9580018019aca6d82e0a558e8f /src/style.rs
parent2245582fbef18d94b0bef2fec3389f710dadc8d9 (diff)
Use new Style struct, wrapping ansi_term::Style
Diffstat (limited to 'src/style.rs')
-rw-r--r--src/style.rs31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/style.rs b/src/style.rs
index ede5d3da..17a265f3 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -1,4 +1,19 @@
-use ansi_term::{Color, Style};
+use ansi_term::{self, Color};
+
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct Style {
+ pub ansi_term_style: ansi_term::Style,
+ pub is_syntax_highlighted: bool,
+}
+
+impl Style {
+ pub fn new() -> Self {
+ Self {
+ ansi_term_style: ansi_term::Style::new(),
+ is_syntax_highlighted: false,
+ }
+ }
+}
pub const LIGHT_THEMES: [&str; 5] = [
"GitHub",
@@ -86,17 +101,3 @@ const DARK_THEME_PLUS_COLOR_256: Color = Color::Fixed(22);
const DARK_THEME_PLUS_EMPH_COLOR: Color = Color::RGB(0x00, 0x60, 0x00);
const DARK_THEME_PLUS_EMPH_COLOR_256: Color = Color::Fixed(28);
-
-/// A special color value to signify that the foreground color of a style should be derived from
-/// syntax highlighting.
-pub const SYNTAX_HIGHLIGHTING_COLOR: Color = Color::White; // TODO
-
-pub trait SyntaxHighlightable {
- fn is_syntax_highlighted(&self) -> bool;
-}
-
-impl SyntaxHighlightable for Style {
- fn is_syntax_highlighted(&self) -> bool {
- self.foreground == Some(SYNTAX_HIGHLIGHTING_COLOR)
- }
-}