ColorPickerPropertiesVersion1.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Collections.Generic; 6 using System.Text.Json; 7 using System.Text.Json.Serialization; 8 9 using Microsoft.PowerToys.Settings.UI.Library.Enumerations; 10 11 namespace Microsoft.PowerToys.Settings.UI.Library 12 { 13 public class ColorPickerPropertiesVersion1 14 { 15 public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x43); 16 17 public ColorPickerPropertiesVersion1() 18 { 19 ActivationShortcut = DefaultActivationShortcut; 20 ChangeCursor = false; 21 ColorHistory = new List<string>(); 22 ColorHistoryLimit = 20; 23 VisibleColorFormats = new Dictionary<string, bool>(); 24 VisibleColorFormats.Add("HEX", true); 25 VisibleColorFormats.Add("RGB", true); 26 VisibleColorFormats.Add("HSL", true); 27 ShowColorName = false; 28 ActivationAction = ColorPickerActivationAction.OpenColorPicker; 29 } 30 31 public HotkeySettings ActivationShortcut { get; set; } 32 33 [JsonPropertyName("changecursor")] 34 [JsonConverter(typeof(BoolPropertyJsonConverter))] 35 public bool ChangeCursor { get; set; } 36 37 [JsonPropertyName("copiedcolorrepresentation")] 38 public ColorRepresentationType CopiedColorRepresentation { get; set; } 39 40 [JsonPropertyName("activationaction")] 41 public ColorPickerActivationAction ActivationAction { get; set; } 42 43 [JsonPropertyName("colorhistory")] 44 public List<string> ColorHistory { get; set; } 45 46 [JsonPropertyName("colorhistorylimit")] 47 public int ColorHistoryLimit { get; set; } 48 49 [JsonPropertyName("visiblecolorformats")] 50 public Dictionary<string, bool> VisibleColorFormats { get; set; } 51 52 [JsonPropertyName("showcolorname")] 53 [JsonConverter(typeof(BoolPropertyJsonConverter))] 54 public bool ShowColorName { get; set; } 55 56 public override string ToString() 57 => JsonSerializer.Serialize(this, SettingsSerializationContext.Default.ColorPickerPropertiesVersion1); 58 } 59 }