Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6352073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:07:58+00:00 2026-05-24T22:07:58+00:00

Possible Duplicate: Windows 7 Tasbar Icons Highlight Color Windows 7 uses some algorithm to

  • 0

Possible Duplicate:
Windows 7 Tasbar Icons Highlight Color

Windows 7 uses some algorithm to detect the average color of a pinned item in the Windows 7 taskbar in some way. Note how when you hover over an item, the glow color is the same as the icon.

Is there an API for getting that color?

Or is there an alternative?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:07:58+00:00Added an answer on May 24, 2026 at 10:07 pm

    [Edit: C# Code as requested]

    Ok, well, in C# it actually could be done more-or-less like the link I gave, but there’s really no reason to do all the masking and shifting, since you can already access a System.Drawing.Color‘s ARGB values directly in C#. (Oh, by the way, I wasn’t sure whether to average the Alpha value, I went with “yes”.)

    If your source data is in ints instead Color, you can always just convert the values with the function Color.FromArgb with a single int argument. (It supports also creating it from individual values, as shown in the example code’s returns.)

    The LINQ version looks a loot easier to understand to me, but I gave the other one since it’s basically a C# port of the original code I linked.

    LINQ version:

        public Color AverageColorsWithLINQ(Color[] ColorsToAverage)
        {
            // the LINQ way
            int AlphaAverage = (int)ColorsToAverage.Average(c => c.A);
            int RedAverage = (int)ColorsToAverage.Average(c => c.R);
            int GreenAverage = (int)ColorsToAverage.Average(c => c.G);
            int BlueAverage = (int)ColorsToAverage.Average(c => c.B);
    
            return Color.FromArgb(
                AlphaAverage, RedAverage, GreenAverage, BlueAverage
            );
        }
    

    Loop, sum, and divide version:

        public Color AverageColorsWithFor(Color[] ColorsToAverage)
        {
            int AlphaTotal = 0;
            int RedTotal = 0;
            int GreenTotal = 0;
            int BlueTotal = 0;
    
            foreach (Color AColor in ColorsToAverage)
            {
                AlphaTotal += AColor.A;
                RedTotal += AColor.R;
                GreenTotal += AColor.G;
                BlueTotal += AColor.B;
            }
    
            double NumberOfColors = ColorsToAverage.Length;
    
            int AlphaAverage = (int)(AlphaTotal / NumberOfColors);
            int RedAverage = (int)(RedTotal / NumberOfColors);
            int GreenAverage = (int)(GreenTotal / NumberOfColors);
            int BlueAverage = (int)(BlueTotal / NumberOfColors);
    
            return Color.FromArgb(
                AlphaAverage, RedAverage, GreenAverage, BlueAverage
            );
        }
    

    Well, I would check out How do I adjust the brightness of a color? which covers several different ways of doing it.

    I’m not really sure what model Windows 7 is using to do it, but basically there are different models you can use to pick a color out of colorspace, and, in particular, HSL and HSV (http://en.wikipedia.org/wiki/HSL_and_HSV) can both be used to increase and decrease the perceived brightness of the color without altering it too much.

    Upon re-reading your question I think I may have misunderstood. If you actually mean to average a block of colors, I would give this a shot: http://blog.soulwire.co.uk/code/actionscript-3/extract-average-colours-from-bitmapdata . It looks like it’s doing it via RGB, though, and I’m not familiar enough to know whether that gives good results (for instance, it doesn’t do a good job of raising or lowering brightness of a color to adjust the colors proportionally…)

    So, if that doesn’t give you good results, I would recommend trying converting all the colors to either HSV or HSL, averaging those values together instead, and then converting back to RGB.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Windows Taskbar API Win32: How to hide 3rd party windows in taskbar
Possible Duplicate: How does Windows change Aero Glass color? using c# how do you
Possible Duplicate: How to detect Windows 64 bit platform with .net? I'm using this
Possible Duplicate: How to detect Windows 64 bit platform with .net? At a low
Possible Duplicate: Detect Antivirus on Windows using C# In .net I would like to
Possible Duplicate: How to detect Windows 64 bit platform with .net? How do you
Possible Duplicate: How to detect Windows 64 bit platform with .net? How can I
Possible Duplicate: .NET windows application, can it be compressed into a single .exe? To
Possible duplicate What is the best open source example of a lightweight Windows Application?
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.