Skip to content
Snippets Groups Projects
Commit f3b3b66f authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Cleanup: Remove color option from all modules and parser

Please use _color instead.
parent 400b16a6
No related branches found
No related tags found
No related merge requests found
...@@ -110,15 +110,13 @@ interface Module ...@@ -110,15 +110,13 @@ interface Module
class ModuleConstant: Module class ModuleConstant: Module
{ {
string text; string text;
Color color;
public void Init(ModuleParent _bar, ConfigSection section) public void Init(ModuleParent _bar, ConfigSection section)
{ {
text = section.Mandatory("text"); text = section.Mandatory("text");
color = section?["color"]?.AsColor() ?? System.Drawing.ColorTranslator.FromHtml("white");
} }
public IEnumerable<Block> Get() 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 ...@@ -138,14 +136,14 @@ class ModuleFile: Module
new ConfigParser( new ConfigParser(
@" @"
[constant] [constant]
color = red _color = red
text = NFound text = NFound
")); "));
ifReadError = new InnerStatusBar(_bar, section.Optional("error_handler")?.AsConfig() ?? ifReadError = new InnerStatusBar(_bar, section.Optional("error_handler")?.AsConfig() ??
new ConfigParser( new ConfigParser(
@" @"
[constant] [constant]
color = red _color = red
text = ERR text = ERR
")); "));
parser = _bar.GetGlobal<ParserGetter>().ByNameFromConfig(section.Optional("parser")); parser = _bar.GetGlobal<ParserGetter>().ByNameFromConfig(section.Optional("parser"));
...@@ -353,7 +351,7 @@ class ModuleHttp: ModuleSourceThreadAndParser ...@@ -353,7 +351,7 @@ class ModuleHttp: ModuleSourceThreadAndParser
new ConfigParser( new ConfigParser(
@" @"
[constant] [constant]
color = red _color = red
text = ERR text = ERR
")); "));
period_ms = section.Optional("period")?.AsMs() ?? 10000; period_ms = section.Optional("period")?.AsMs() ?? 10000;
......
...@@ -104,15 +104,13 @@ interface Parser ...@@ -104,15 +104,13 @@ interface Parser
[ParserName("text")] [ParserName("text")]
class ParserText: Parser class ParserText: Parser
{ {
Color color;
public void Init(ModuleParent _bar, Module _module, ConfigSection section) 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) public IEnumerable<Block> Parse(string data)
{ {
if(data.Length > 0 && data[^1] == '\n') data = data[..^1]; 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();
} }
} }
......
...@@ -176,7 +176,6 @@ short_format = {percent} ...@@ -176,7 +176,6 @@ short_format = {percent}
[constant] [constant]
# Just show some text # Just show some text
text = Hi! text = Hi!
color = red
[file] [file]
...@@ -184,11 +183,11 @@ color = red ...@@ -184,11 +183,11 @@ color = red
path = $HOME/file/to/show path = $HOME/file/to/show
# mandatory <path> # mandatory <path>
not_found_handler = [constant] not_found_handler = [constant]
color = red _color = red
text = NFound text = NFound
# <config> default see above # <config> default see above
error_handler = [constant] error_handler = [constant]
color = red _color = red
text = ERR text = ERR
# <config> default see above # <config> default see above
...@@ -267,7 +266,7 @@ stdin ...@@ -267,7 +266,7 @@ stdin
# Fetch message from http(s) (for example a JSON api). # Fetch message from http(s) (for example a JSON api).
error_handler = [constant] error_handler = [constant]
color = red _color = red
text = ERR text = ERR
# See file module # See file module
...@@ -317,10 +316,6 @@ _default_color = red ...@@ -317,10 +316,6 @@ _default_color = red
# Parser: text # Parser: text
# ------------ # ------------
# Each line will be one segment of status bar. # Each line will be one segment of status bar.
#
# Options:
# color = red
# <color>
# Parser: osdd_last # Parser: osdd_last
# ------------ # ------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment