Function convertRgbToLedColor

  • Converts a standard 24-bit RGB color value into a format suitable for certain LED controllers.

    The conversion swaps the red and green channels, producing a new 24-bit integer where:

    • Original green becomes the most significant byte,
    • Original red becomes the middle byte,
    • Original blue remains the least significant byte.

    Returns

    The converted 24-bit LED color value with swapped red and green channels.

    Example

    const rgb = 0x112233;
    const ledColor = convertRgbToLedColor(rgb); // → 0x221133

    Remarks

    • Useful when interfacing with LED hardware that expects a different channel ordering.
    • Input and output are standard JavaScript numbers representing 24-bit colors.

    Parameters

    • value: number

      A 24-bit RGB color represented as a number (0xRRGGBB).

    Returns number

Generated using TypeDoc