Skip to main content

ILampArray::SetColorsForScanCodes

Sets the color of one or more Lamps, corresponding to keyboard scan codes. Position within each array maps keys to desired colors.

Syntax

Parameters

scanCodesCount Type: uint32_t The size of the color and scan code buffers. scanCodes  _In_reads_(scanCodesCount) Type: uint32_t* The array of scan codes for which color updates are being applied. desiredColors  _In_reads_(scanCodesCount) Type: LampArrayColor* The array of corresponding Lamp colors.

Return value

Type: void

Remarks

Scan codes buffer and desired colors buffer are implied to be the same size. Black (a zero-filled LampArrayColor) is equivalent to a Lamp being ‘off’. The alpha value (LampArrayColor::a) represents the relative transparency of a color, where zero is fully transparent and 0xFF is fully opaque. If an alpha value other than 0xFF is used, the color will undergo an additional blending step against black. To avoid this blending step, do not pass in any alpha value other than 0xFF when setting colors. Lamp state will not be flushed to the device if the ILampArray is disabled for the current process (see ILampArray::SetIsEnabled). If a scan code is not bound to any Lamp on the device, it is ignored and the remaining scan codes are still applied. If a scan code is used multiple times in the same buffer, the API will overwrite the previous state of any Lamps corresponding to that scan code. If ILampArray::SupportsScanCodes returns false, this function will have no effect. The following sample shows how to set Lamp colors for the WASD keys on the keyboard.

Requirements

Header: LampArray.h Library: xgameplatform.lib Supported platforms: XBOX One family consoles and XBOX Series consoles

See also

Lighting API Overview
Setting Colors on a LampArray
Windows Keyboard Input Reference - Scan Codes
LampArrayColor
ILampArray::SetColor
ILampArray::SetColorsForIndices
ILampArray
Last modified on August 20, 2026