Color Picker Parameter

Created at 08 Mar 2019, 18:01
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
eivaremir's avatar

eivaremir

Joined 08.03.2019

Color Picker Parameter
08 Mar 2019, 18:01


Hey do you know a way on how to pass color names as parameters and parsing them into cAlgo.aPI.Color type?

 

thanks


@eivaremir
Replies

afhacker
08 Mar 2019, 18:18

        public static Color GetColor(string colorString, int alpha = 255)
        {
            Color color = colorString[0] == '#' ? Color.FromHex(colorString) : Color.FromName(colorString);

            return Color.FromArgb(alpha, color);
        }

 


@afhacker

eivaremir
08 Mar 2019, 19:41

RE:

afhacker said:

        public static Color GetColor(string colorString, int alpha = 255)
        {
            Color color = colorString[0] == '#' ? Color.FromHex(colorString) : Color.FromName(colorString);

            return Color.FromArgb(alpha, color);
        }

Thanks dude!

 


@eivaremir