mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[ColorPicker]Store color history in a separated file (#23146)
* [ColorPicker] Store color history in a separated file * ColorPicker] Separated file for color history: use the list from the settings.json if there is no ColorHistory.json file (preventing loss of existing color history) * Fix case when there is no history saved or no settings file at all.
This commit is contained in:
@@ -16,7 +16,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
ActivationShortcut = new HotkeySettings(true, false, false, true, 0x43);
|
||||
ChangeCursor = false;
|
||||
ColorHistory = new List<string>();
|
||||
ColorHistoryLimit = 20;
|
||||
VisibleColorFormats = new Dictionary<string, KeyValuePair<bool, string>>();
|
||||
VisibleColorFormats.Add("HEX", new KeyValuePair<bool, string>(true, ColorFormatHelper.GetDefaultFormat("HEX")));
|
||||
@@ -50,6 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("activationaction")]
|
||||
public ColorPickerActivationAction ActivationAction { get; set; }
|
||||
|
||||
// Property ColorHistory is not used, the color history is saved separatedly in the colorHistory.json file
|
||||
[JsonPropertyName("colorhistory")]
|
||||
public List<string> ColorHistory { get; set; }
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
newSettings.Properties.ActivationShortcut = oldSettings.Properties.ActivationShortcut;
|
||||
newSettings.Properties.ChangeCursor = oldSettings.Properties.ChangeCursor;
|
||||
newSettings.Properties.ActivationAction = oldSettings.Properties.ActivationAction;
|
||||
newSettings.Properties.ColorHistory = new List<string>(oldSettings.Properties.ColorHistory);
|
||||
newSettings.Properties.ColorHistoryLimit = oldSettings.Properties.ColorHistoryLimit;
|
||||
newSettings.Properties.ShowColorName = oldSettings.Properties.ShowColorName;
|
||||
newSettings.Properties.ActivationShortcut = oldSettings.Properties.ActivationShortcut;
|
||||
|
||||
Reference in New Issue
Block a user