Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

[GUI] Limited colors (brushes) available

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [GUI] Limited colors (brushes) available

    In NT7 we were not limited to only predefined sets of Colors as it is now with Brushes set.
    If I wanted to change to some custom color I could in the color box type r,g,b or #hex code and get the exact color wanted.
    It looks like this may have been overlooked now as the only option available in NT8 is to select from predefined Brushes.

    On the NinjaScript side it would be good if some helper/extension methods were created that would assist in some color/brush operation and bring similar functionality as known from System.Drawing.Color.
    One such example is:
    Code:
    System.Drawing.Color.FromArgb(int alpha, Color baseColor);
    Which lets you easily set the opacity of the known color eg:
    Code:
    Color testColor = Color.FromArgb(50,Color.Red));
    Try to do the same in one line with System.Windows.Media.Brush and Color and you will see why I am raising this issue.

    EDIT: To be clear - Brush gives incomparable functionality to old Colors - but people used to the old ways will have some problems transferring to the new Brush way
    Last edited by gregid; 05-11-2015, 07:48 PM.

    #2
    gregid,

    You are not limited to predefined set of brushes. You can always create your own using:
    new SolidColorBrush()
    new LinearGradientBrush()
    new RadialGradientBrush() etc.
    ArtSenior Software Developer

    Comment


      #3
      Originally posted by NinjaTrader_Art View Post
      gregid,

      You are not limited to predefined set of brushes. You can always create your own using:
      new SolidColorBrush()
      new LinearGradientBrush()
      new RadialGradientBrush() etc.
      I unnecesarily included 2 separate issues, so you misunderstood - the limited set of brushes is from the GUI - PropertyGrid to be exact.

      From the code I can't complain on the use of brushes - the options are vastly greater!

      Comment


        #4
        If you're working within the context of a custom indicator/object, you can actually define a custom brush to be added to the standard color picker by using a [CustomBrush] attribute to a public brush (yet to be documented). This approach will use reflection to find all public brush defined in the script and will display these brushes in the color picker on the top of the list.

        Code:
        [CustomBrush, Browsable(false)]
        public Brush MyBrush
        { 
        	get { return new SolidColorBrush(Color.FromRgb(25, 175, 185)); } 
        	set { }
        }
        In the example above, I've made it Browsable false as well so it's not displayed on the property grid as a separate entry; however the CustomBrush attribute will then add it to the color picker menu for that indicator when you look through the plots (would be at top)

        If you're looking for more global colors for general UI settings, you can add a custom color to the color picker through a Skin. Take a look at the Documents\NinjaTrader 8\templates\Skins\Slate Gray\BluePrint.xaml and look for the customColorPickerList collection. You could add your own just by:

        Code:
        <collections:ArrayList x:Key="customColorPickerList">
        	<SolidColorBrush	Color="#4C0000"		po:Freeze="true" wpg:DisplayHelper.Display="My Prefered Red Color" />
        </collections:ArrayList>
        While the skin color picker list would make this color more global, the disadvantage is you'd have to distribute this skin to your users to select any of those custom colors, which is why the CustomBrush approach has been provided as well for NinjaScript objects.
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Art View Post
          gregid,

          You are not limited to predefined set of brushes. You can always create your own using:
          new SolidColorBrush()
          new LinearGradientBrush()
          new RadialGradientBrush() etc.
          When creating do you need to do you need to do it in OnRender()? I am tring to Draw.Square with a custom color.

          See error in the image

          Code:
          Draw.Square(this,"tag"+CurrentBar.ToString()+i,true,0,(MAX(High,Period)[0]) - ((i)*TickSize*BoxSize),MyBrush);
          Sody
          Attached Files
          Last edited by SodyTexas; 05-12-2015, 04:18 PM.

          Comment


            #6
            Thanks Matthew for the info on how to predefine my own custom colors, but I am afraid it is still far from NT7 flexibility:

            (you could do it both with (a)rgb and hex codes)

            Would it be possible to implement something similar in NT8? I rarely used predefined colors as I tend to adjust background colors depending on what's on the chart
            Last edited by gregid; 05-13-2015, 06:37 AM.

            Comment


              #7
              Thanks for clarifying. I've logged your request using ID SFT-359
              MatthewNinjaTrader Product Management

              Comment


                #8
                Thanks for implementing this - works as in NT7 now which is great!

                Comment


                  #9
                  Originally posted by gregid View Post
                  Thanks for implementing this - works as in NT7 now which is great!
                  You are welcome...we also added full support for hexadecimal values. We have docs here for anyone interested:

                  MatthewNinjaTrader Product Management

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by algospoke, Yesterday, 06:40 PM
                  2 responses
                  24 views
                  0 likes
                  Last Post algospoke  
                  Started by ghoul, Today, 06:02 PM
                  3 responses
                  15 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  46 views
                  0 likes
                  Last Post jeronymite  
                  Started by Barry Milan, Yesterday, 10:35 PM
                  7 responses
                  23 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  10 responses
                  181 views
                  0 likes
                  Last Post jeronymite  
                  Working...
                  X