Solved Adjust Luminosity via VBA of any color value to it's lightest shade (1 Viewer)

GeoWorld

New member
Local time
Today, 12:01
Joined
Apr 24, 2024
Messages
3
You are correct, I'm using Excel VBA. I don't need to convert back, I was just testing your routines and it seemed to me the reverse should work. My ultimate goal is to calculate Microsoft color shading and I found other code that's supposed to be able to apply a shading percentage to HSL (but it doesn't work). If only MS would publish their algorithm or just put the all color numbers in the XML files. Here's some more debugging:

RGBtoHSL: 13020235 to [H] 128.455284552846, 124.556962025316, [L] 128.470588235294
----------------------------------------
============ HSLtoRGB ============
h=0.356820234869017
s=1.24556962025316
l=1.28470588235294
x1=1.63932688011913
x2=0.930084884586748
red=418.028354430379
green=237.171645569621
blue=392.541772151897
===================================
HSLtoRGB: 16772607 from [H] 128.455284552846, 124.556962025316, [L] 128.470588235294
HSLtoRGB: [R] 0, [G] 0, 0
----------------------------------------

As you can see, the red, green, and blue values come out high from HUEtoRGB function in HSLtoRGB function. I used your routines verbatim (other than adding Debug.Print statements).
 

isladogs

MVP / VIP
Local time
Today, 20:01
Joined
Jan 14, 2017
Messages
18,217
Hi
I have both RGB to HLS & HLS to RGB converters as part of my Colour Converter app.

The code isn't mine and isn't actually used in that app so can't vouch for its accuracy. The source for that code was:

I also have a Qqh to RGB converter where H = hue. Can't remember what Q means
 

Users who are viewing this thread

Top Bottom