video_displaygamma(3)
π video_displaygamma(3) β the Arcan Lua API glow-up π
okay bestie, settle in, because this one is literally about making your screen look correct π
it lives in the Arcan Lua API and it's called video_displaygamma, and no cap it's the main character of color correction.
β¨ NAME β¨
video_displaygamma β get or set the gamma ramps for a display, fr fr π
πΈ SYNOPSIS πΈ
[tbl or boolean]
video_displaygamma( dispid or vid, tbl, index )
π DESCRIPTION π
So some hardware platforms and displays support hardware accelerated gamma and color correction π₯ and this function is your girl for two whole moods: testing whether those features even exist, and changing or querying the values that are currently active.
dispid is either 0 for the default display, or it gets handed to you as a hotplug event in the applname_display_event handler. iconic.
You can also use a vid instead β but only if the connected client supports the extended color ramp subprotocol and has been granted permissions to synch such tables by setting the permission bit through target_flags TARGET_ALLOWCM. gatekeeping, but make it permissions. π In this case, tbl may also contain an 'edid' key with the display ID, and the optional index (default=0) display subindex will be used. Clients that enable this feature will trigger the 'proto_change' event and may start generating 'ramp_update' events in the event of suggested ramp updates. the way that just keeps happening π
If the optional tbl argument is not set, the gamma tables get queried and returned as a number-indexed table, with the individual channels (r, g, b) packed as separated planes like this:
tbl[1] = r, tbl[#tbl/3] = g, tbl[#tbl/3*2] = b
all as numbers in the 0.0 to 1.0 range. cute, tidy, obsessed π
If the optional tbl argument is set, the gamma tables for the display get updated with the new values, and the function returns true or false depending on whether the device accepted the tables or not. π
β οΈ bestie listen to me β mismatching tables may be a terminal state transition, so only use tables that come from a previous call to video_displaygamma. do not freestyle this. periodt.
π¦ EXAMPLE π¦
function video_displaygamma0()
local tbl = video_displaygamma(0);
if (tbl and #tbl > 0) then
for i=1,#tbl/3 do
tbl[i] = tbl[i] * 0.1;
end
video_displaygamma(0, tbl);
else
warning("display does not support gamma tables");
end
end
look at her go π grab the table, check it's actually got something in it, scale the first third down by 0.1, push it back β and if there's nothing there, warning("display does not support gamma tables"). graceful. we love a fallback. π
π SEE ALSO π
vidsys β go say hi, iykyk π«Ά
mwah π this lil page is from October 2026, brought to you by the Arcan Lua API β stay glowing, stay calibrated, and don't touch tables that didn't come from video_displaygamma. slay β¨
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms