I am trying to write a program where the user gives you the rgb value for a color and how many shades and tints they want to print out. Basically I just want to print out a grid with the left most color being the base color the user entered and then depending on if its shades or tints get lighter or darker until it reaches black or white.
For example:
User input: r = 255, g = 0, b = 0, numTints = 5, numShades = 8
Print Shades: red, darker red, darker red, darker red, black.
Same for Tint only getting lighter till it gets to white.
I'm new to programming and python, so I am having trouble figuring out how to calculate the shades and tints and have it stop on black and white.
Basically you want to keep the ratio between the components constant. So, to make it darker, simply multiply all 3 components by a constant. e.g. 0.9 again and again, until they're all 0, meaning black.
To make brighter, multiply by a number larger than 1, and clamp at 255