public static Color NodeColorStringToColor(string s)
        {
            switch (s)
            {
            case "Aqua":
                return(Color.cyan);

            case "Blue":
                return(NodeColor_Blue);

            case "Gray":
                return(NodeColor_Gray);

            case "Green":
                return(NodeColor_Green);

            case "Grey":
                return(Color.gray);

            case "Orange":
                return(NodeColor_Orange);

            case "Red":
                return(NodeColor_Red);

            case "Yellow":
                return(Color.yellow);

            default:
                return(Tools.WebColor(s));
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new EmphasisSetting.
 /// </summary>
 /// <param name='colorCode'>
 /// A web RGB-format color code of the format "\#rrggbb", where rr, gg, and bb are
 /// hexadecimal values (e.g., \#ff0000 for red).
 /// </param>
 /// <param name='styleCode'>
 /// A style code of the format "biu", where b=bold, i=italic, u=underline, and a dash turns
 /// the setting off. For example, "b--" means bold only.
 /// </param>
 public EmphasisSetting(string colorCode, string styleCode)
 {
     color     = Tools.WebColor(colorCode);
     bold      = !string.IsNullOrEmpty(styleCode) && (styleCode.Length > 0) && (styleCode[0] == 'b');
     italic    = (!string.IsNullOrEmpty(styleCode)) && (styleCode.Length > 1) && (styleCode[1] == 'i');
     underline = (!string.IsNullOrEmpty(styleCode)) && (styleCode.Length > 2) && (styleCode[2] == 'u');
 }
        // ITextEffect
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Color_Blink);

            _range = effectParams.Range;

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.FrequencyAttribute))
            {
                _frequency = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.FrequencyAttribute]);
            }
            Assert.IsTrue(_frequency >= 0);

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorFromAttribute))
            {
                _colorFrom = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorFromAttribute]);
            }

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorToAttribute))
            {
                _colorTo = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorToAttribute]);
            }
        }
        // ITextEffect
        public void Initialize(TextEffectParams effectParams)
        {
            Assert.IsTrue(effectParams.EffectType == TextEffectType.Color_Transition);

            _range = effectParams.Range;

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.SpeedAttribute))
            {
                _transitionSpeed = Tools.StringToFloat(effectParams.Attributes[TextEffectsAttributes.SpeedAttribute]);
            }
            Assert.IsTrue(_transitionSpeed >= 0);

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorFromAttribute))
            {
                _colorFrom = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorFromAttribute]);
            }

            if (effectParams.Attributes.ContainsKey(TextEffectsAttributes.ColorToAttribute))
            {
                _colorTo = Tools.WebColor(effectParams.Attributes[TextEffectsAttributes.ColorToAttribute]);
            }
        }