How is Sentinel 2 MSI Natural Colours Profile in SNAP calculated

I created my question here original:

Using the ESA Toolbox named SNAP one can load a sentinel 2 data package and see a RGB view using the profile.

I am wondering what this profile in mathematical terms are.

Is it just information about which bands to use? Is it a weighting of the bands? Is it static across time/geo position?

How would one create a RGB geotiff from a sentinel 2 data package using GDAL?

I noticed that seeing the RGB images in SNAP they seemed dark. What tools do we have to auto adjust images to best possible visual appeal?

The current profiles only map single band data to each R, G and B channel.
You can modify them yourself, using band math if you need. You can save your formula for the profile for reusing it later.

Then, for each channel, in the Color Manipulation tab, you can select how raw data maps to actual 8bpp R/G/B value, by manipulating the transfer function. The default rendering uses a 95% rule (it cuts 2.5 % of the pixels on each side of the histogram).

You can export data to GeoTIFF from SNAP (File->Export menu). But currently this does not use compression, so the size of the output will explode compared to the input JP2-compressed rasters.