summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI.Installer/InteractiveInstaller.cs4
-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
-rw-r--r--src/SMAPI.sln6
-rw-r--r--src/SMAPI/Framework/Monitor.cs4
-rw-r--r--src/SMAPI/SMAPI.config.json1
8 files changed, 39 insertions, 9 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs
index 2d58baf0..5b0c6e1f 100644
--- a/src/SMAPI.Installer/InteractiveInstaller.cs
+++ b/src/SMAPI.Installer/InteractiveInstaller.cs
@@ -88,8 +88,8 @@ namespace StardewModdingApi.Installer
yield return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "ErrorLogs"); // remove old log files
}
- /// <summary>Handles writing color-coded text to the console.</summary>
- private ColorfulConsoleWriter ConsoleWriter;
+ /// <summary>Handles writing text to the console.</summary>
+ private IConsoleWriter ConsoleWriter;
/*********
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
diff --git a/src/SMAPI.sln b/src/SMAPI.sln
index 62eaa777..f9c537c4 100644
--- a/src/SMAPI.sln
+++ b/src/SMAPI.sln
@@ -81,7 +81,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SMAPI.Web.LegacyRedirects",
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ SMAPI.Internal\SMAPI.Internal.projitems*{0634ea4c-3b8f-42db-aea6-ca9e4ef6e92f}*SharedItemsImports = 5
+ SMAPI.Internal\SMAPI.Internal.projitems*{0a9bb24f-15ff-4c26-b1a2-81f7ae316518}*SharedItemsImports = 5
+ SMAPI.Internal\SMAPI.Internal.projitems*{1b3821e6-d030-402c-b3a1-7ca45c2800ea}*SharedItemsImports = 5
+ SMAPI.Internal\SMAPI.Internal.projitems*{80efd92f-728f-41e0-8a5b-9f6f49a91899}*SharedItemsImports = 5
SMAPI.Internal\SMAPI.Internal.projitems*{85208f8d-6fd1-4531-be05-7142490f59fe}*SharedItemsImports = 13
+ SMAPI.Internal\SMAPI.Internal.projitems*{cd53ad6f-97f4-4872-a212-50c2a0fd3601}*SharedItemsImports = 5
+ SMAPI.Internal\SMAPI.Internal.projitems*{e6da2198-7686-4f1d-b312-4a4dc70884c0}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/src/SMAPI/Framework/Monitor.cs b/src/SMAPI/Framework/Monitor.cs
index f630c7fe..44eeabe6 100644
--- a/src/SMAPI/Framework/Monitor.cs
+++ b/src/SMAPI/Framework/Monitor.cs
@@ -15,8 +15,8 @@ namespace StardewModdingAPI.Framework
/// <summary>The name of the module which logs messages using this instance.</summary>
private readonly string Source;
- /// <summary>Handles writing color-coded text to the console.</summary>
- private readonly ColorfulConsoleWriter ConsoleWriter;
+ /// <summary>Handles writing text to the console.</summary>
+ private readonly IConsoleWriter ConsoleWriter;
/// <summary>Manages access to the console output.</summary>
private readonly ConsoleInterceptionManager ConsoleInterceptor;
diff --git a/src/SMAPI/SMAPI.config.json b/src/SMAPI/SMAPI.config.json
index 57b4f885..a426b0ef 100644
--- a/src/SMAPI/SMAPI.config.json
+++ b/src/SMAPI/SMAPI.config.json
@@ -73,6 +73,7 @@ copy all the settings, or you may cause bugs due to overridden changes in future
* automatically on Linux or Windows.
* - LightBackground: use darker text colors that look better on a white or light background.
* - DarkBackground: use lighter text colors that look better on a black or dark background.
+ * - None: disables all colors, so everything is written in the default terminal color.
*
* For available color codes, see https://docs.microsoft.com/en-us/dotnet/api/system.consolecolor.
*