C++ s0beit rainbow gradient with primary color setting

Blume

Active member
Joined
May 14, 2018
Messages
38
Reaction score
11
Location
China
now create ur big rainbow shit lmao

Declare 2 globals:
C++:
DWORD m_dRainbowHex;
float m_fRainbowRGB[3];


Add function (If you don't know how to get ImGui working then just find an alternative approach for converting RGB and HSV):
Provide a length between 1-20 and a hue between 0-1 it should work fine
C++:
void UpdateRainbow(float *primaryRGB, float length, float hue) {
    //Blume's rainbow rewrite
    
    float primaryHSB[3];
    ImGui::ColorConvertRGBtoHSV(primaryRGB[0], primaryRGB[1], primaryRGB[2], primaryHSB[0], primaryHSB[1], primaryHSB[2]);

    float lengthMs = length * 1000.0f;
    float timedHue = GetTickCount() % (long int)(lengthMs) / lengthMs;

    //"hue" for "indexedHue"
    float hue2 = timedHue + hue * 0.05f + 1.f;
    ImGui::ColorConvertHSVtoRGB(hue2, primaryHSB[1], primaryHSB[2], m_fRainbowRGB[0], m_fRainbowRGB[1], m_fRainbowRGB[2]);
    m_dRainbowHex = D3DCOLOR_RGBA((int)m_fRainbowRGB[0], (int)m_fRainbowRGB[1], (int)m_fRainbowRGB[2], 255);
}
 
Top