Skip to content
Discussion options

You must be logged in to vote

Your approach is basicly correct. The part you're missing is the rounding.

For your two colors the channel averages are:

R: (0x77 + 0x7B) / 2 = 0x79
G: (0xA3 + 0xA6) / 2 = 164.5 decimal = 0xA4.8
B: (0xE0 + 0xDD) / 2 = 222.5 decimal = 0xDE.8
So #79A4DE is what you get if you truncate the fractional parts. If you round to the nearest integer instead, you get:

#79A5DF
For more colors, do exactly the same thing: sum each R, G and B component seperately, divide each sum by the number of colors, round, then convert back to hex.

For all five colors in the question, that gives approximately:

R = 118
G = 161.6
B = 220.2

=> #76A2DC
Also, a mixer showing #77A3E0 at "0%" isn't saying that's the avera…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by noseherbalindo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussions GitHub Discussions is a collaborative communication feature Product Feedback Share your thoughts and suggestions on GitHub features and improvements Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates
2 participants