I am not aware what Windows 8 or new YouTube app does, since I do not use either, but if you want to get an N-colours palette sorted by frequency, i. e. you seeking how to get from image.png
:

a palette.png
:

or palette.txt
:
#D2615E
#B24953
#DE8D75
#5D133B
#65214C
#D36F6D
#EECAAA
#DCA295
#C78E79
#8F283D
#CEB3B6
#99364B
#A36A90
#A95D6B
#7B4886
#75416E
then it’s quite a basic task for any image processing tool.
That how it could be done with ImageMagick (plus a bit of GNU Bash, Coreutils and AWK):
$ convert "image.png" -colors 16 -depth 8 -format '%c' histogram:info:- \
| sort --reverse --numeric-sort \
| gawk 'match ($0, /^ *[0-9]+: \([^)]+\) (#[0-9A-F]+) .+$/, a) { print a[1] }' \
| tee "palette.txt" \
| while read colour; do convert -size 20x20 "xc:$colour" +depth miff:-; done \
| montage - -geometry +0+0 "palette.png"
That’s an example, of course; you have not to exec convert
and monage
via system(3)
call from your program – interfaces for ImageMagick are available for all popular languages: C, C++, Perl, Python, Ruby, Java, etc. And it is a free/libre software (covered by Apache v2 license, to be precise).