diff --git a/Module.cs b/Module.cs index 82b646067d2dee857751a5a698286981fe502c5f..a30a0d28531663a647eac0a3235565978d52d316 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 735c809e68f0fa33304d58224f23a93aecee2373..649ded0757a95b92274836ced6508ebdc7a19532 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 6fe2e40a251f4b3ccf496eed85f83381154d22d4..44c872662c1190351ba7749a49b0a9872fac4acd 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 # ------------