Screen color picker format parsing

This commit is contained in:
Jaex 2015-01-26 10:48:49 +02:00
parent 974db173b6
commit f431b7e154
2 changed files with 7 additions and 13 deletions

View file

@ -516,18 +516,12 @@ public static void OpenScreenColorPicker(TaskSettings taskSettings = null)
if (pointInfo != null)
{
string text;
string text = taskSettings.AdvancedSettings.ScreenColorPickerFormat;
switch (taskSettings.AdvancedSettings.ScreenColorPickerFormat)
{
default:
case ColorPickerFormat.RGB:
text = string.Format("{0}, {1}, {2}", pointInfo.Color.R, pointInfo.Color.G, pointInfo.Color.B);
break;
case ColorPickerFormat.Hexadecimal:
text = ColorHelpers.ColorToHex(pointInfo.Color);
break;
}
text = text.Replace("$r", pointInfo.Color.R.ToString(), StringComparison.InvariantCultureIgnoreCase).
Replace("$g", pointInfo.Color.G.ToString(), StringComparison.InvariantCultureIgnoreCase).
Replace("$b", pointInfo.Color.B.ToString(), StringComparison.InvariantCultureIgnoreCase).
Replace("$hex", ColorHelpers.ColorToHex(pointInfo.Color), StringComparison.InvariantCultureIgnoreCase);
ClipboardHelpers.CopyText(text);

View file

@ -433,8 +433,8 @@ public Size ToastWindowSize
[Category("Name pattern"), DefaultValue(50), Description("Maximum name pattern title (%t) length for file name.")]
public int NamePatternMaxTitleLength { get; set; }
[Category("Tools"), DefaultValue(ColorPickerFormat.RGB), Description("When using quick screen color picker what color format to copy to clipboard automatically.")]
public ColorPickerFormat ScreenColorPickerFormat { get; set; }
[Category("Tools"), DefaultValue("$r, $g, $b"), Description("When using screen color picker what to copy to clipboard automatically. Formats: $r, $g, $b, $hex")]
public string ScreenColorPickerFormat { get; set; }
public TaskSettingsAdvanced()
{