예제 #1
0
        public static BoardThemeConfig FromJson(JsonValue json)
        {
            var config = new BoardThemeConfig();

            config.Indicators = BoardThemeIndicatorsConfig.FromJson(json["indicators"]);

            if (json.ContainsKey("rim"))
            {
                config.Rim = BoardThemeRimConfig.FromJson(json["rim"]);
            }

            return(config);
        }
예제 #2
0
        public static BoardThemeRimConfig FromJson(JsonValue json)
        {
            var config = new BoardThemeRimConfig();

            config.Thickness = JsonValueReader.ReadPercentToFloat01(json["thickness"]);

            if (json.ContainsKey("indicators"))
            {
                config.DrawIndicatorsOnRim = true;

                var indicatorsJson = json["indicators"];
                config.IndicatorsOnBothSides = indicatorsJson["indicators_on_both_sides"];
            }
            else
            {
                config.DrawIndicatorsOnRim = false;
            }

            if (json.ContainsKey("inner_transition"))
            {
                var transitionJson = json["inner_transition"];
                config.InnerTransition = new Transition(
                    JsonValueReader.ReadPercentToFloat01(transitionJson["thickness"]),
                    ColorTranslator.FromHtml(transitionJson["color"])
                    );
            }

            if (json.ContainsKey("outer_transition"))
            {
                var transitionJson = json["outer_transition"];
                config.OuterTransition = new Transition(
                    JsonValueReader.ReadPercentToFloat01(transitionJson["thickness"]),
                    ColorTranslator.FromHtml(transitionJson["color"])
                    );
            }

            return(config);
        }