What standard is the skin color system in?

Request help for teeworlds-related subjects (mapping, servers, ..).
For client issues, see our repositories (https://github.com/ddnet/ddnet/issues).
Post Reply
GG Kid
Posts: 266
Joined: Sun Apr 16, 2017 2:33 am
Location: U.S.A.
Player profile: https://ddnet.tw/players/Bolto/
Clan: Kerger

What standard is the skin color system in?

Post by GG Kid »

What standard is the skin coloring system in? it seems to very roughly follow Hex & HTML code's for color selection but will not except any Alphabet letters
what i'm looking for is a external application to select color code's to input into TW
User avatar
deen
TECHNICAL Team
Posts: 3575
Joined: Mon May 05, 2014 2:30 pm
Player profile: https://ddnet.org/players/deen/
Discord: deen#5910

Re: What standard is the skin color system in?

Post by deen »

HSL
GG Kid
Posts: 266
Joined: Sun Apr 16, 2017 2:33 am
Location: U.S.A.
Player profile: https://ddnet.tw/players/Bolto/
Clan: Kerger

Re: What standard is the skin color system in?

Post by GG Kid »

deen wrote: Mon Nov 13, 2017 8:22 amHSL
are you sure? the HSL scheme don't work
here's a very blue color
player_color_body 11009792 but when i input those numbers to a web HSL colorizer it turn out very differently & visa-versa

by reverse engineering i have come to the conclusion the the client some how computes the Hue, Saturation, & Luminosity/Lightness to some other standard as to which i don't know, but changing one will change the sequence, not like in these systems i know it's not or at least don't work all the time, (E.G. they translate to another color)
RGBa,HSLa, ARGB, RGBA, ABGR, BGRA, RGB, BGR, HWB.
so what's the coding system for the TW skin colors?

helped me understand HSL (Hue, Saturation, Lightness)
http://vanseodesign.com/web-design/hue- ... lightness/
HMH
Posts: 145
Joined: Mon May 05, 2014 8:41 pm
Player profile: http://ddnet.tw/players/HMH/

Re: What standard is the skin color system in?

Post by HMH »

Teeworlds and DDNet indeed use HSL but in a somewhat awkward way. You can obtain the values for HSL by first converting the number the client gives you to hexadecimal. Then you split that hexadecimal up into pairs of two characters each (so you get one byte) and finally convert these back to decimal which show you the actual values for HSL, except for the L value which needs to be converted to the range 128 to 255.

Example:
Say you find this number as your body-color: 10223467 (this is how team blue is colored btw) .
What you do is to convert this to hex: 10223467 -> 9bff6b and split it up as described: 9b ff 6b. Then convert each of these two digit hex numbers back to decimal: 155 255 107. Then you need to adjust the 107 to fit to the range 128 to 255 using the following formula: f(l) = trunc(l/2) + 128 which leads to H = 155 S = 255 L = 181. And this is indeed the nice blue of team blue.

The same formula applied to your color gives me: H = 167 S = 255 L = 128, a darker blue.

The extra adjustment we do to the L value is in order to disallow coloring Tees black.
GG Kid
Posts: 266
Joined: Sun Apr 16, 2017 2:33 am
Location: U.S.A.
Player profile: https://ddnet.tw/players/Bolto/
Clan: Kerger

Re: What standard is the skin color system in?

Post by GG Kid »

--- HMH instructions-------
step 1. convert the Player_color_body Value from Decimal to Hexadecimal
Examble: team blue player_color_body 10223467 to hex 9BFF6B
step 2. divide that into chuncks of two
Example: 9b ff 6b
stpe 3. individually convert the pairs back to Decimal | these should now be HSL (Hue, Saturation, Lightness)
Example: 155 255 107

forgive my lack of understanding but how can you have a Saturation or Lightness of over a hundred? i though those were in a percent % scale & there for max out at 100.
i'm sorry but i can't use the information you gave because i can't have a Saturation or Lightness at anything over 100%, are there different standards & i'm just using the wrong one?
i'd like to think i'm not stupid but it's not looking very good. also inputing 155255181 as a color make's it just white....
Test 1Show
step 1. convert the Player_color_body Value from Decimal to Hexadecimal
Examble: a very red player_color_body 65280 to hex FF00
step 2. divide that into chuncks of two
Example: ff 00
stpe 3. individually convert the pairs back to Decimal | these should now be HSL (Hue, Saturation, Lightness)
Example: H = 255 S = 0 L =

& now what? i don't understand the formula: f(l) = trunc (l/2) + 128 | so "F is L" & they equal shortened one half plus 128?
wow maybe i should have studied harder in school :(
Test 2Show
step 1. convert the Player_color_body Value from Decimal to Hexadecimal
Examble: the Default color, a red-ish player_color_body 65408 to hex FF80
step 2. divide that into chuncks of two
Example: ff 80
stpe 3. individually convert the pairs back to Decimal | these should now be HSL (Hue, Saturation, Lightness)
Example: H = 255 S = 128 L = ""
inputing player_color_body 25580 works, so whats up?
Tools used:
Decimal & Hexadecimal https://www.mathsisfun.com/binary-decim ... erter.html
HSL http://hslpicker.com
HMH
Posts: 145
Joined: Mon May 05, 2014 8:41 pm
Player profile: http://ddnet.tw/players/HMH/

Re: What standard is the skin color system in?

Post by HMH »

GG Kid wrote: Sun Nov 19, 2017 8:15 pm forgive my lack of understanding but how can you have a Saturation or Lightness of over a hundred? i though those were in a percent % scale & there for max out at 100.
Hehe, you have to think like a Coder, we use one byte to store the values H, S and L each which gives us the range 0 to 255 for each of these. So 255 is 100%.

Also I am sorry, it seems I did not remember the formula for correcting L properly, I will see if I have some time to figure it out.

And about your tests: You have to zero pad the hex value if it is shorter than 6 digits i.e.: ff80 -> 00ff80 -> 00 ff 80.

Edit: If you are interested, the code for color-conversion can be found here: https://github.com/ddnet/ddnet/blob/277 ... #L202-L211
and here:
https://github.com/ddnet/ddnet/blob/277 ... #L390-L444
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests