Change Color Density of Rectangle

I have a rectangle with text labels within it. I am having the FillColor of the rectangle change will the type of data I am working with - however some of the colors are too dark to read the text.

What I want to do is keep the same color but get a lighter version of it. So for example, if the color is black, a lighter shade (say grey). Same goes for dark blues and dark greens.

d_Appt is a dictionary that stores the color value.

Here is where I am so far:

dim col as variant = d_Appt.Value(“color”).StringValue
dim c2 as Variant = col.ColorValue
RoundRectangle1.FillColor= c2

I am thinking something with transparency but I just can’t figure out how to get from here to there. ?

faced with a similar situation recently, I pre-calculated a set of ‘pale’ colors
My simple but effective method was

var r,g,b as integer
r = + 126
g = + 126
b = + 126

newcolor = rgb(r,g,b)

I would think you would want to measure the color of the text versus the color of the background to calculate the contrast to ensure the text is always readable. If the color of the text is static that is enough but still might be good to compare to the random color you generate for the background. Or, put constraints on the background color in your color generation algo to make sure you don’t generate something not readable.

Color.RGB(red As Integer, green As Integer, blue As Integer, alpha As Integer = 0) As Color

The important part here is Alpha As Integer…

Perfect. Thank you so much.