How could I make a colour darker or lighter? I know there are available methods for transparency but I need to create something like this:
Is there any method to increase the darkness of a colour value? The way I am currently doing it is by using a ball sprite on a black canvas and picking the colour of the pixel. However this is an issue every now and then as the ball sprite and canvas do not load correctly and crash the app. So i was hoping there is a simpler method or formula for it.
The first one I don’t really like since it stops working and just shows a blank color after a while (on 2 phones) Its also more complicated than my current method. I am trying to see if i can implement my hex value input with the second extension.
Edit: Thank you very much but the extension is not suitable for my needs and the first method is essentially my method with extra sprites.
I have deleted it now but the issue was I would quickly move my finger across the canvas and after a few seconds it would stop changing colours and the background would just turn white. with the sprite overlays.
That’s an easy solution, Just add an if condition asking if the currentx or currenty is greater than the canvas width or height and that should fix it.
If you don’t want to use sprites to create gradients, then you should come up with the math to get the intermediate colors from one color to the other and draw the lines in that color one by one.
I have a gradient already using the gradient extension and a slider. I use a ball sprite and a black canvas and change the transparency of the ball depending on where the slider is then pick the pixel colour. I was just hoping that the second canvas wasn’t necessary and there is a formula or something or extension. Alpha value for example is nice and simple, the higher the value the more opaque it is.
Well, I don’t see how anyone can make this any easier than that. If that is not practical for you, ask an extension developer to make a custom one for you.
I don’t think it should be too hard to make a procedure to input a color and a percentage and return that color darker or lighter in that percentage. I will try later and see what I can do.
May be you are over complicating things. Forget hex for a minute. You can convert the rgb values to hex after you are done.
Doing this in rgb is way easier. That’s how I’m going to approach it too. Then the procedure will convert the 3 or 4 channels into an hex value.