Talk:Z12997

From Wikifunctions
Latest comment: 18 days ago by Autom in topic Gamma preservation

Multilingual support for color names

Hello @Asked42, this functions is interesting. I dont know the English names of more specific colors as it is not my native language or a language I speak often. Do you think it is possible to add multilingual support for color names, maybe also in another function. Hogü-456 (talk) 21:37, 26 February 2024 (UTC)Reply

I believe that the supported named colours are the Web standard ones from https://www.w3.org/wiki/CSS/Properties/color/keywords rather than nominally in a "language". I don't think we should really encourage them over the hex values. Jdforrester (WMF) (talk) 21:45, 26 February 2024 (UTC)Reply
I think it is not necessary to include other color names in this function. I think this function could be used in a Wikipedia article about mix colors. In such a case it is important to make it easy to use. So there is an easy way needed that enables a user to enter the necessary information to use the function. I have seen for example color pickers or color palettes where it is possible to select a specific color. I hope that something like that will be supported in the Wikimedia projects somewhen. From my point of view it is essential for the sucess of Wikifunctions to make it easy enough to use functions. Hogü-456 (talk) 22:08, 26 February 2024 (UTC)Reply
Yes, in the future it might be possible to have a special kind of interactive input that lets users pick a colour, but that's distinct from what this function currently does. :-) Jdforrester (WMF) (talk) 20:28, 27 February 2024 (UTC)Reply

Gamma preservation

@Asked42: The current implementations only take the arithmetic means of the component colors (which results in too dark colors). For preservation of gamma in the sRGB space, the components need to be normalized first:

(r_new/255)^2.2 = [ (r_one/255)^2.2 + (r_two/255)^2.2 ] / 2
(b_new/255)^2.2 = [ (b_one/255)^2.2 + (b_two/255)^2.2 ] / 2
(g_new/255)^2.2 = [ (g_one/255)^2.2 + (g_two/255)^2.2 ] / 2

Assuming a gamma value of 2.2

For the sake of completeness, this would technically also affect how you round back to an integer, but that error is arguably imperceivable and the pivot point is a horrifying function of the mixed values (thus also different for each component).

-- Autom (talk) 01:21, 11 May 2024 (UTC)Reply