We have 2 colors, set in RGB, 1 byte per color.
If you take and fold each of the colors, then divide by 2, it turns out in my opinion is not quite right. Suppose FF0000 and 00FF00 give birth to 7F7F00 in this way, which looks much darker than both its "parents". If in this way we assume the average between FF0000 and FFFF00, then it will be FF7F00, which is apparently closer to FF0000 than to FFFF00. At a glance, the average between them is about FFAA00.
In each pixel of the monitor, we have 3 subpixels, the power supplied to which varies from 0 to 255 (some points) at a given color depth, if I understand correctly. I want to find out how to calculate mathematically a color that would be “average” between two given ones, namely, it would be similar to each of them in equal measure, while having an average brightness between them. Perhaps there are standard libraries in development environments that do something like this?
div { width: 6em; height: 6em; display: inline-block; font-family: monospace; text-indent: -12ch; overflow: hidden; } div:after { content: attr(style); } <div style=background:#FF0000></div> <div style=background:#7F7F00></div> <div style=background:#00FF00></div> <br><br> <div style=background:#FF0000></div> <div style=background:#FF7F00></div> <div style=background:#FFFF00></div> 



