diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/main.rs b/src/main.rs index 734dfd1..0cb7261 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ use syntect::{ }; fn main() { - match std::env::var("CGIT_SYNTECT_MODE").as_deref().ok() { + match std::env::var("MODE").as_deref().ok() { Some("compile") => compile(), Some("theme") => theme(), None | Some("") | Some("highlight") => highlight(), @@ -50,22 +50,13 @@ fn theme() { let mut css_gen = Vec::new(); let mut scopes_gen = Vec::new(); - let mut global_css = String::new(); let credit = match (theme.name, theme.author) { (None, None) => "".to_string(), - (None, Some(author)) => format!("/* theme by {author} */\n"), - (Some(name), None) => format!("/* {name} theme */\n"), - (Some(name), Some(author)) => format!("/* {name} theme by {author} */\n"), + (None, Some(author)) => format!("/* by {author} */\n"), + (Some(name), None) => format!("/* {name} */\n"), + (Some(name), Some(author)) => format!("/* {name} by {author} */\n"), }; - global_css.push_str(&credit); - global_css.push_str(".highlight {\n"); - if let Some(bg) = theme.settings.background { - global_css.push_str(" background-color: #"); - global_css.push_str(&hex_color(bg)); - global_css.push_str(";\n"); - } - global_css.push_str("}\n"); - css_gen.push(global_css); + css_gen.push(credit); for (idx, item) in theme.scopes.into_iter().enumerate() { let selectors_str = selectors_to_string(item.scope); |