🗝
summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-06-03 21:35:16 -0700
committermia <mia@mia.jetzt>2024-06-03 21:35:16 -0700
commit044df10ee3a53deead2f17144c5b3def8f2b03ab (patch)
treecf65e6bd30e4256e8377b633106fd683089dd156 /src
parent40509ba913e52196b2dd7f3a733bec816d38bda0 (diff)
downloadcgit-syntect-main.tar.gz
cgit-syntect-main.zip
remove global background, shorten mode var HEAD v0.2.0 main
Diffstat (limited to 'src')
-rw-r--r--src/main.rs19
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);