1
I set up this function that takes the HEX converts to DEC calculates the gain and converts again to HEX
hex
-> without the #
ganho
-> percentage from 0 to 100
return you can edit according to need.
function ganho(hex, ganho) {
var r = Number.parseInt(Number.parseInt(hex.substring(0,2), 16) * ((ganho / 100) + 1)).toString(16).padStart(2, '0');
var g = Number.parseInt(Number.parseInt(hex.substring(2,4), 16) * ((ganho / 100) + 1)).toString(16).padStart(2, '0');
var b = Number.parseInt(Number.parseInt(hex.substring(4,6), 16) * ((ganho / 100) + 1)).toString(16).padStart(2, '0');
return r + g + b;
}
console.log(ganho('101010', 10));
My 20% raise was
#E1AF24
for#FFD22B
, how you did the cover bill this raise?– Leonardo Barros
It would not be easier to work with RGB colors and then convert to hexadecimal, making it easier to calculate the shades?
– Victor Laio
Leonardo I’m sorry, but in fact it’s 10% vo edit rs
– Patrique Alves
@Victorlaio I have tried but not succeeded via rgb
– Patrique Alves