From f3b3b66f35d11ef83a3df800f8623c28fad260f6 Mon Sep 17 00:00:00 2001
From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz>
Date: Sat, 13 Aug 2022 00:02:01 +0200
Subject: [PATCH] Cleanup: Remove color option from all modules and parser

Please use _color instead.
---
 Module.cs   | 10 ++++------
 Parsers.cs  |  4 +---
 sample.conf | 11 +++--------
 3 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/Module.cs b/Module.cs
index 82b6460..a30a0d2 100644
--- a/Module.cs
+++ b/Module.cs
@@ -110,15 +110,13 @@ interface Module
 class ModuleConstant: Module
 {
 	string text;
-	Color color;
 	public void Init(ModuleParent _bar, ConfigSection section)
 	{
 		text = section.Mandatory("text");
-		color = section?["color"]?.AsColor() ?? System.Drawing.ColorTranslator.FromHtml("white");
 	}
 	public IEnumerable<Block> Get()
 	{
-		return new Block[]{new Block(text, Color: color)};
+		return new Block[]{new Block(text)};
 	}
 }
 
@@ -138,14 +136,14 @@ class ModuleFile: Module
 				new ConfigParser(
 @"
 [constant]
-color = red
+_color = red
 text = NFound
 "));
 		ifReadError  = new InnerStatusBar(_bar, section.Optional("error_handler")?.AsConfig() ??
 				new ConfigParser(
 @"
 [constant]
-color = red
+_color = red
 text = ERR
 "));
 		parser = _bar.GetGlobal<ParserGetter>().ByNameFromConfig(section.Optional("parser"));
@@ -353,7 +351,7 @@ class ModuleHttp: ModuleSourceThreadAndParser
 				new ConfigParser(
 @"
 [constant]
-color = red
+_color = red
 text = ERR
 "));
 		period_ms = section.Optional("period")?.AsMs() ?? 10000;
diff --git a/Parsers.cs b/Parsers.cs
index 735c809..649ded0 100644
--- a/Parsers.cs
+++ b/Parsers.cs
@@ -104,15 +104,13 @@ interface Parser
 [ParserName("text")]
 class ParserText: Parser
 {
-	Color color;
 	public void Init(ModuleParent _bar, Module _module, ConfigSection section)
 	{
-		color = section.Optional("color")?.AsColor() ?? System.Drawing.ColorTranslator.FromHtml("white");
 	}
 	public IEnumerable<Block> Parse(string data)
 	{
 		if(data.Length > 0 && data[^1] == '\n') data = data[..^1];
-		return data.Split("\n").Select(x => new Block(x, Color: color)).ToArray();
+		return data.Split("\n").Select(x => new Block(x)).ToArray();
 	}
 }
 
diff --git a/sample.conf b/sample.conf
index 6fe2e40..44c8726 100644
--- a/sample.conf
+++ b/sample.conf
@@ -176,7 +176,6 @@ short_format = {percent}
 [constant]
 # Just show some text
 text = Hi!
-color = red
 
 
 [file]
@@ -184,11 +183,11 @@ color = red
 path = $HOME/file/to/show
 # mandatory <path>
 not_found_handler = [constant]
-        color = red
+        _color = red
         text = NFound
 # <config> default see above
 error_handler = [constant]
-        color = red
+        _color = red
         text = ERR
 # <config> default see above
 
@@ -267,7 +266,7 @@ stdin
 # Fetch message from http(s) (for example a JSON api).
 
 error_handler = [constant]
-        color = red
+        _color = red
         text = ERR
 # See file module
 
@@ -317,10 +316,6 @@ _default_color = red
 # Parser: text
 # ------------
 # Each line will be one segment of status bar.
-# 
-# Options:
-#   color = red
-#   <color>
 
 # Parser: osdd_last
 # ------------
-- 
GitLab