Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to get the current color number / luminance of current program window

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

    how to get the current color number / luminance of current program window

    hi
    in my addon, i want to change the text color based on the current overall color schema.
    i know this , NinjaTrader.Core.Globals.GeneralOptions.Skin
    but its not what i want :

    i have bellow . but i dont know which Resource to search for ...
    Code:
    private SolidColorBrush windowBackgroundBrush ,textColor, backgroundColor;
    
    
    windowBackgroundBrush = System.Windows.Application.Current.TryFindResource("????????????    ")   as SolidColorBrush ?? new SolidColorBrush(Brushes.Purple.Color);
    //Calculate the luminance of the background color
    double luminance = (0.2126 * windowBackgroundBrush.Color.R + 0.7152 * windowBackgroundBrush.Color.G + 0.0722 * windowBackgroundBrush.Color.B) / 255.0;
    // Determine the text color based on the luminance
    textColor = luminance < 0.5 ? Brushes.White :Brushes.Black ;
    backgroundColor = luminance < 0.5 ?  Brushes.Black :Brushes.White;
    Last edited by dadarara; 03-31-2024, 08:52 AM.

    #2
    Hello dadarara,

    Thanks for your post.

    If NinjaTrader.Core.Globals.GeneralOptions.Skin is not what you are looking for, please provide us with a brief explanation detailing what exactly you are looking to access the brush color of and what exactly you are trying to accomplish so we may accurately assist you.

    Are you trying to access the brush color of a specific item in a NinjaTrader Skin Blueprint.xml file?

    We look forward to assisting further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      I though i did provide brief explanation.
      I need to know the background color of the main application. let say the main control window. this will allow me to set the color of my text .

      Comment


        #4
        Hello dadarara,

        Thanks for your notes.

        This would go outside the scope of support we would be able to provide you with in the NinjaTrader Support department.

        If you would like to get the Chart background you could try using the ChartControl.Properties.ChartBackground property to see if it suits your use case.

        ChartControl.Properties - https://ninjatrader.com/support/helpGuides/nt8/chartcontrol_properties.htm

        The forum thread will be open for other community members to share their insights on possible unsupported code you could try using to accomplish this.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          maybe you can just tell me the name of the resource I need to search for, in the command bellow?

          System.Windows.Application.Current.TryFindResource ("???????????? ") as SolidColorBrush ?? new SolidColorBrush(Brushes.Purple.Color);

          it is after all ninjatrader application resource ? isn't it ?

          Comment


            #6
            Hello dadarara,

            Thanks for your notes.

            It seems that you may want BackgroundMainWindow or WindowBottomGradientStopColor.

            The background for the Control Center is WindowBottomGradientStopColor.

            Please let us know if we may assist further.
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #7
              didnt help

              Comment


                #8
                Hello dadarara,

                Thanks for your notes.

                There are no supported NinjaScript methods/properties for getting the main background color of the NinjaTrader application and doing so would go outside the scope of support we would be able to provide you with.

                This forum thread will be open for other community members to share their insights on possible unsupported code you could consider trying.
                <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                579 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                334 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                554 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X