Brush myBrush = new SolidColorBrush(Oscillator[0] > 0 ? Color.FromArgb(Convert.ToByte(Math.Abs(osc[0])*255), 12, 181, 26) : Color.FromArgb(Convert.ToByte(Math.Abs(osc[0])*255), 255, 17, 0)); myBrush.Freeze(); PlotBrushes[0][0] = myBrush;
I've used RGB values and this is hard coded and cannot be user changed
now I want for the user to define a color using an input parameter, which I did and called it BullColor
[NinjaScriptProperty] [XmlIgnore] [Display(Name="BullColor", Order=2, GroupName="Parameters")] public Brush BullColor { get { return new SolidColorBrush(Color.FromRgb(8, 153, 129)); } set{} } [Browsable(false)] public string BullColorSerializable { get { return Serialize.BrushToString(BullColor); } set { BullColor = Serialize.StringToBrush(value); } }
but now I want to change opacity/transparency of this color dynamically
so that user can set the color, but the script will make it transparent based on a value.
since I don't know RGB values from this color (not sure how to find it out)
and since it's a Brush not a Color I am not sure how to continue with this.
I am completely unsure of how to use .Opacity and where as whenever I've tried to use it I've gotten an object error
Error on calling 'OnBarUpdate' method on bar 14: Object reference not set to an instance of an object.
Comment