summaryrefslogtreecommitdiff
path: root/src/SMAPI.Internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Internal')
-rw-r--r--src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs16
-rw-r--r--src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs11
-rw-r--r--src/SMAPI.Internal/ConsoleWriting/MonitorColorScheme.cs5
-rw-r--r--src/SMAPI.Internal/SMAPI.Internal.projitems1
4 files changed, 28 insertions, 5 deletions
diff --git a/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs b/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs
index aefda9b6..b5bd4600 100644
--- a/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs
+++ b/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs
@@ -4,8 +4,8 @@ using StardewModdingAPI.Toolkit.Utilities;
namespace StardewModdingAPI.Internal.ConsoleWriting
{
- /// <summary>Provides a wrapper for writing color-coded text to the console.</summary>
- internal class ColorfulConsoleWriter
+ /// <summary>Writes color-coded text to the console.</summary>
+ internal class ColorfulConsoleWriter : IConsoleWriter
{
/*********
** Fields
@@ -30,8 +30,16 @@ namespace StardewModdingAPI.Internal.ConsoleWriting
/// <param name="colorConfig">The colors to use for text written to the SMAPI console.</param>
public ColorfulConsoleWriter(Platform platform, ColorSchemeConfig colorConfig)
{
- this.SupportsColor = this.TestColorSupport();
- this.Colors = this.GetConsoleColorScheme(platform, colorConfig);
+ if (colorConfig.UseScheme == MonitorColorScheme.None)
+ {
+ this.SupportsColor = false;
+ this.Colors = null;
+ }
+ else
+ {
+ this.SupportsColor = this.TestColorSupport();
+ this.Colors = this.GetConsoleColorScheme(platform, colorConfig);
+ }
}
/// <summary>Write a message line to the log.</summary>
diff --git a/src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs b/src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs
new file mode 100644
index 00000000..fbcf161c
--- /dev/null
+++ b/src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs
@@ -0,0 +1,11 @@
+namespace StardewModdingAPI.Internal.ConsoleWriting
+{
+ /// <summary>Writes text to the console.</summary>
+ internal interface IConsoleWriter
+ {
+ /// <summary>Write a message line to the log.</summary>
+ /// <param name="message">The message to log.</param>
+ /// <param name="level">The log level.</param>
+ void WriteLine(string message, ConsoleLogLevel level);
+ }
+}
diff --git a/src/SMAPI.Internal/ConsoleWriting/MonitorColorScheme.cs b/src/SMAPI.Internal/ConsoleWriting/MonitorColorScheme.cs
index bccb56d7..994ea6a5 100644
--- a/src/SMAPI.Internal/ConsoleWriting/MonitorColorScheme.cs
+++ b/src/SMAPI.Internal/ConsoleWriting/MonitorColorScheme.cs
@@ -10,6 +10,9 @@ namespace StardewModdingAPI.Internal.ConsoleWriting
DarkBackground,
/// <summary>Use darker text colors that look better on a white or light background.</summary>
- LightBackground
+ LightBackground,
+
+ /// <summary>Disable console color.</summary>
+ None
}
}
diff --git a/src/SMAPI.Internal/SMAPI.Internal.projitems b/src/SMAPI.Internal/SMAPI.Internal.projitems
index 7fcebc94..0d583a6d 100644
--- a/src/SMAPI.Internal/SMAPI.Internal.projitems
+++ b/src/SMAPI.Internal/SMAPI.Internal.projitems
@@ -12,6 +12,7 @@
<Compile Include="$(MSBuildThisFileDirectory)ConsoleWriting\ColorfulConsoleWriter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConsoleWriting\ColorSchemeConfig.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConsoleWriting\ConsoleLogLevel.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)ConsoleWriting\IConsoleWriter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConsoleWriting\MonitorColorScheme.cs" />
</ItemGroup>
</Project> \ No newline at end of file