Example #1
0
        private void SetupAllColorRepresentations()
        {
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HEX.ToString(),
#pragma warning disable CA1304 // Specify CultureInfo
                Convert = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HEX).ToLower()); },
#pragma warning restore CA1304 // Specify CultureInfo
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.RGB.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.RGB)); },
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSL.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSL)); },
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSV.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSV)); },
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.CMYK.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.CMYK)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSB.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSB)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSI.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSI)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HWB.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HWB)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.NCol.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.NCol)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.CIELAB.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.CIELAB)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.CIEXYZ.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.CIEXYZ)); },
            });

            _userSettings.VisibleColorFormats.CollectionChanged += VisibleColorFormats_CollectionChanged;

            // Any other custom format to be added here as well that are read from settings
        }
        private void SetupAllColorRepresentations()
        {
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HEX.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HEX)); },
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.RGB.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.RGB)); },
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSL.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSL)); },
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSV.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSV)); },
            });

            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.CMYK.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.CMYK)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSB.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSB)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HSI.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HSI)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.HWB.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.HWB)); },
            });
            _allColorRepresentations.Add(
                new ColorFormatModel()
            {
                FormatName = ColorRepresentationType.NCol.ToString(),
                Convert    = (Color color) => { return(ColorRepresentationHelper.GetStringRepresentationFromMediaColor(color, ColorRepresentationType.NCol)); },
            });

            _userSettings.VisibleColorFormats.CollectionChanged += VisibleColorFormats_CollectionChanged;

            // Any other custom format to be added here as well that are read from settings
        }