summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Framework/Models/SConfig.cs4
-rw-r--r--src/SMAPI/Framework/Monitor.cs6
-rw-r--r--src/SMAPI/Framework/SCore.cs4
-rw-r--r--src/SMAPI/SMAPI.config.json51
4 files changed, 48 insertions, 17 deletions
diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs
index 40ed9512..b778af5d 100644
--- a/src/SMAPI/Framework/Models/SConfig.cs
+++ b/src/SMAPI/Framework/Models/SConfig.cs
@@ -67,8 +67,8 @@ namespace StardewModdingAPI.Framework.Models
/// <summary>Whether to generate a file in the mods folder with detailed metadata about the detected mods.</summary>
public bool DumpMetadata { get; set; }
- /// <summary>The console color scheme to use.</summary>
- public MonitorColorScheme ColorScheme { get; set; }
+ /// <summary>The colors to use for text written to the SMAPI console.</summary>
+ public ColorSchemeConfig ConsoleColors { get; set; }
/// <summary>The mod IDs SMAPI should ignore when performing update checks or validating update keys.</summary>
public string[] SuppressUpdateChecks { get; set; }
diff --git a/src/SMAPI/Framework/Monitor.cs b/src/SMAPI/Framework/Monitor.cs
index 1fa55a9e..06cf1b46 100644
--- a/src/SMAPI/Framework/Monitor.cs
+++ b/src/SMAPI/Framework/Monitor.cs
@@ -50,9 +50,9 @@ namespace StardewModdingAPI.Framework
/// <param name="source">The name of the module which logs messages using this instance.</param>
/// <param name="consoleInterceptor">Intercepts access to the console output.</param>
/// <param name="logFile">The log file to which to write messages.</param>
- /// <param name="colorScheme">The console color scheme to use.</param>
+ /// <param name="colorConfig">The colors to use for text written to the SMAPI console.</param>
/// <param name="isVerbose">Whether verbose logging is enabled. This enables more detailed diagnostic messages than are normally needed.</param>
- public Monitor(string source, ConsoleInterceptionManager consoleInterceptor, LogFileManager logFile, MonitorColorScheme colorScheme, bool isVerbose)
+ public Monitor(string source, ConsoleInterceptionManager consoleInterceptor, LogFileManager logFile, ColorSchemeConfig colorConfig, bool isVerbose)
{
// validate
if (string.IsNullOrWhiteSpace(source))
@@ -61,7 +61,7 @@ namespace StardewModdingAPI.Framework
// initialize
this.Source = source;
this.LogFile = logFile ?? throw new ArgumentNullException(nameof(logFile), "The log file manager cannot be null.");
- this.ConsoleWriter = new ColorfulConsoleWriter(Constants.Platform, colorScheme);
+ this.ConsoleWriter = new ColorfulConsoleWriter(Constants.Platform, colorConfig);
this.ConsoleInterceptor = consoleInterceptor;
this.IsVerbose = isVerbose;
}
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 08d30a29..e293cefd 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -143,7 +143,7 @@ namespace StardewModdingAPI.Framework
// init basics
this.Settings = JsonConvert.DeserializeObject<SConfig>(File.ReadAllText(Constants.ApiConfigPath));
this.LogFile = new LogFileManager(logPath);
- this.Monitor = new Monitor("SMAPI", this.ConsoleManager, this.LogFile, this.Settings.ColorScheme, this.Settings.VerboseLogging)
+ this.Monitor = new Monitor("SMAPI", this.ConsoleManager, this.LogFile, this.Settings.ConsoleColors, this.Settings.VerboseLogging)
{
WriteToConsole = writeToConsole,
ShowTraceInConsole = this.Settings.DeveloperMode,
@@ -1351,7 +1351,7 @@ namespace StardewModdingAPI.Framework
/// <param name="name">The name of the module which will log messages with this instance.</param>
private Monitor GetSecondaryMonitor(string name)
{
- return new Monitor(name, this.ConsoleManager, this.LogFile, this.Settings.ColorScheme, this.Settings.VerboseLogging)
+ return new Monitor(name, this.ConsoleManager, this.LogFile, this.Settings.ConsoleColors, this.Settings.VerboseLogging)
{
WriteToConsole = this.Monitor.WriteToConsole,
ShowTraceInConsole = this.Settings.DeveloperMode,
diff --git a/src/SMAPI/SMAPI.config.json b/src/SMAPI/SMAPI.config.json
index 225e4b3f..bccac678 100644
--- a/src/SMAPI/SMAPI.config.json
+++ b/src/SMAPI/SMAPI.config.json
@@ -10,12 +10,9 @@ The default values are mirrored in StardewModdingAPI.Framework.Models.SConfig to
*/
{
/**
- * The console color theme to use. The possible values are:
- * - AutoDetect: SMAPI will assume a light background on Mac, and detect the background color 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.
+ * Whether SMAPI should log more information about the game context.
*/
- "ColorScheme": "AutoDetect",
+ "VerboseLogging": false,
/**
* Whether SMAPI should check for newer versions of SMAPI and mods when you load the game. If new
@@ -58,11 +55,6 @@ The default values are mirrored in StardewModdingAPI.Framework.Models.SConfig to
"WebApiBaseUrl": "https://api.smapi.io",
/**
- * Whether SMAPI should log more information about the game context.
- */
- "VerboseLogging": false,
-
- /**
* Whether SMAPI should log network traffic (may be very verbose). Best combined with VerboseLogging, which includes network metadata.
*/
"LogNetworkTraffic": false,
@@ -74,6 +66,45 @@ The default values are mirrored in StardewModdingAPI.Framework.Models.SConfig to
"DumpMetadata": false,
/**
+ * The colors to use for text written to the SMAPI console.
+ *
+ * The possible values for 'UseScheme' are:
+ * - AutoDetect: SMAPI will assume a light background on Mac, and detect the background color
+ * 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.
+ *
+ * For available color codes, see https://docs.microsoft.com/en-us/dotnet/api/system.consolecolor.
+ *
+ * (These values are synched with ColorfulConsoleWriter.GetDefaultColorSchemeConfig in the
+ * SMAPI code.)
+ */
+ "ConsoleColors": {
+ "UseScheme": "AutoDetect",
+
+ "Schemes": {
+ "DarkBackground": {
+ "Trace": "DarkGray",
+ "Debug": "DarkGray",
+ "Info": "White",
+ "Warn": "Yellow",
+ "Error": "Red",
+ "Alert": "Magenta",
+ "Success": "DarkGreen"
+ },
+ "LightBackground": {
+ "Trace": "DarkGray",
+ "Debug": "DarkGray",
+ "Info": "Black",
+ "Warn": "DarkYellow",
+ "Error": "Red",
+ "Alert": "DarkMagenta",
+ "Success": "DarkGreen"
+ }
+ }
+ },
+
+ /**
* The mod IDs SMAPI should ignore when performing update checks or validating update keys.
*/
"SuppressUpdateChecks": [