/tg/ Station 13 - Modules - Types

modular_aphelion/modules/bulge/code/adaptive_colour.dm

/proc/bulge_round_half_evenPython's round(): a half goes to the even neighbour.
/proc/bulge_rgb_to_hcybulge_v4.rgb_to_hcy: colorsys hue in degrees, chroma and Rec. 601 luma in 0-100, from 0-255 channels.
/proc/bulge_hcy_rawbulge_v4._hcy_raw: HCY to unclamped RGB fractions.
/proc/bulge_hcy_to_rgbbulge_v4.hcy_to_rgb: drops chroma by bisection until the colour fits, then rounds half to even.
/proc/bulge_towardbulge_v4.toward: turns a hue toward a target by at most amount degrees.
/proc/bulge_adaptivebulge_v4.adaptive(cloth, finish, toned = TRUE): the five kinds f, h, H, s, d as lists of three channels.
/proc/bulge_palette_exceptionThe palettes this float32 port computes one off in a channel from the approved values (computed in float64), with the approved palette to use instead: 71 channels in 38 (colour, finish) pairs, all where float64 lands on the other side of a half (#afafaf's shade is exactly 136.5). Found by sweeping every colour the approved palettes were made for, the 4,096-colour grid of multiples of 17 and 760 garment colours, natively against them; every other one of their 218,520 channels the float32 computation gives exactly. A change to the arithmetic above needs that sweep again. Null when the computation stands.