public static EditableColorPaletteEntry Parse(JsonObject data, IColorPaletteEntry sourceColor, IReadOnlyList <ContrastColorWrapper> contrastColors)
        {
            Color customColor;

            if (data.ContainsKey("CustomColor"))
            {
                customColor = data["CustomColor"].GetColor();
            }
            else
            {
                customColor = default(Color);
            }
            bool useCustomColor = false;

            if (data.ContainsKey("UseCustomColor"))
            {
                useCustomColor = data["UseCustomColor"].GetBoolean();
            }

            FluentEditorShared.Utils.ColorStringFormat activeColorStringFormat = FluentEditorShared.Utils.ColorStringFormat.PoundRGB;
            if (data.ContainsKey("ActiveColorStringFormat"))
            {
                activeColorStringFormat = data.GetEnum <FluentEditorShared.Utils.ColorStringFormat>();
            }

            return(new EditableColorPaletteEntry(sourceColor, customColor, useCustomColor, data.GetOptionalString("Title"), data.GetOptionalString("Description"), activeColorStringFormat, contrastColors));
        }
        public ColorPaletteEntry(Color color, string title, string description, FluentEditorShared.Utils.ColorStringFormat activeColorStringFormat, IReadOnlyList <ContrastColorWrapper> contrastColors)
        {
            _activeColor             = color;
            _title                   = title;
            _description             = description;
            _activeColorStringFormat = activeColorStringFormat;

            ContrastColors = contrastColors;
        }
        public new static EditableColorPaletteEntry Parse(JsonObject data, IColorPaletteEntry sourceColor, IReadOnlyList <ContrastColorWrapper> contrastColors)
        {
            Color customColor;

            if (data.ContainsKey("CustomColor"))
            {
                customColor = data["CustomColor"].GetColor();
            }
            else
            {
                customColor = default(Color);
            }
            bool useCustomColor = false;

            if (data.ContainsKey("UseCustomColor"))
            {
                useCustomColor = data["UseCustomColor"].GetBoolean();
            }

            FluentEditorShared.Utils.ColorStringFormat activeColorStringFormat = FluentEditorShared.Utils.ColorStringFormat.PoundRGB;
            if (data.ContainsKey("ActiveColorStringFormat"))
            {
                activeColorStringFormat = data["ActiveColorStringFormat"].GetEnum <FluentEditorShared.Utils.ColorStringFormat>();
            }

            if (data.ContainsKey(nameof(IsHostBackdrop)) && data.ContainsKey(nameof(TintOpacity)) && data.ContainsKey(nameof(TintLuminosityOpacity)))
            {
                var    isHostBackdrop              = data[nameof(IsHostBackdrop)].GetBoolean();
                var    tintOpacity                 = data[nameof(TintOpacity)].GetNumber();
                double?tintLuminosityOpacity       = null;
                var    tintLuminosityOpacityString = data[nameof(TintLuminosityOpacity)].GetString();

                if (double.TryParse(tintLuminosityOpacityString, out var value))
                {
                    tintLuminosityOpacity = value;
                }

                return(new ThemeEditableAcrylicPaletteEntry(isHostBackdrop, tintOpacity, tintLuminosityOpacity, sourceColor, customColor, useCustomColor, data.GetOptionalString("Title"), data.GetOptionalString("Description"), activeColorStringFormat, contrastColors));
            }

            return(new EditableColorPaletteEntry(sourceColor, customColor, useCustomColor, data.GetOptionalString("Title"), data.GetOptionalString("Description"), activeColorStringFormat, contrastColors));
        }
        public EditableColorPaletteEntry(IColorPaletteEntry sourceColor, Color customColor, bool useCustomColor, string title, string description, FluentEditorShared.Utils.ColorStringFormat activeColorStringFormat, IReadOnlyList <ContrastColorWrapper> contrastColors)
        {
            _sourceColor             = sourceColor;
            _customColor             = customColor;
            _useCustomColor          = useCustomColor;
            _title                   = title;
            _description             = description;
            _activeColorStringFormat = activeColorStringFormat;

            if (_useCustomColor || _sourceColor == null)
            {
                _activeColor = _customColor;
            }
            else
            {
                _activeColor = _sourceColor.ActiveColor;
            }

            ContrastColors = contrastColors;
        }
        public static ColorPaletteEntry Parse(JsonObject data, IReadOnlyList <ContrastColorWrapper> contrastColors)
        {
            Color color;

            if (data.ContainsKey("Color"))
            {
                color = data["Color"].GetColor();
            }
            else
            {
                color = default(Color);
            }

            FluentEditorShared.Utils.ColorStringFormat activeColorStringFormat = FluentEditorShared.Utils.ColorStringFormat.PoundRGB;
            if (data.ContainsKey("ActiveColorStringFormat"))
            {
                activeColorStringFormat = data["ActiveColorStringFormat"].GetEnum <FluentEditorShared.Utils.ColorStringFormat>();
            }

            return(new ColorPaletteEntry(color, data.GetOptionalString("Title"), data.GetOptionalString("Description"), activeColorStringFormat, contrastColors));
        }
        public ThemeEditableAcrylicPaletteEntry(bool sourceHostBackdrop, double sourceTintOpacity, double?sourceTintLuminosityOpacity, IColorPaletteEntry sourceColor, Color customColor, bool useCustomColor, string title, string description, FluentEditorShared.Utils.ColorStringFormat activeColorStringFormat, IReadOnlyList <ContrastColorWrapper> contrastColors)
            : base(sourceColor, customColor, useCustomColor, title, description, activeColorStringFormat, contrastColors)
        {
            SourceHostBackdrop = sourceHostBackdrop;
            IsHostBackdrop     = SourceHostBackdrop;

            SourceTintOpacity = sourceTintOpacity;
            TintOpacity       = SourceTintOpacity;

            SourceTintLuminosityOpacity = sourceTintLuminosityOpacity;
            TintLuminosityOpacity       = SourceTintLuminosityOpacity;
        }