So you want each button click to change the background a bit. I did not understand your hex point, but here is one of the scripts, that calculates background color from given numeric value. In this case its the attribute data-colorvalue
I modified it to fit your case and made it so it adds 10 each click. You can play around the math here, that way you get different colors:
// Grab the button:
const btn = document.querySelector('#btn')
// Detect on click event:
btn.onclick = e => {
// Get the buttons color value, parseInt makes sure its INT:
let color_value = parseInt(btn.getAttribute('data-colorvalue'))
// Make the R value based on color_value:
val_r = Math.round((255 * color_value) / 100)
// Make the G value based on color_value:
val_g = Math.round((255 * (100 - color_value)) / 100)
// Make the B value based on color_value:
val_b = Math.round(255 - (color_value * 1.5))
// Format and set as buttons background:
btn.style.backgroundColor = 'rgb(' + val_r + ', ' + val_g + ', ' + val_b + ')'
// Set the new color value plus 10.. you can play with this formula:
btn.setAttribute('data-colorvalue', color_value + 10)
}
<button id="btn" data-colorvalue="1">Click me</button>
If you want to change the hover as pseudo, then you need magic. And thats a completely standalone quesiton.
Your title says text color and question background, color. So if you want to change the text / font color you simply use btn.style.color
instead of backgroundColor.
Psedo classes do not go to your html like so, ever:

EDIT
Based on the additional information provided in the comments, we worked out, that you want to change the hover-background-color each time the button is clicked.
This is a very strange situation and odd request. But one of the ways doing it is making new style element contents on each click like so:
// Grab the button:
const btn = document.querySelector('#btn')
// Make style element:
let style = document.createElement('style')
// Detect on click event:
btn.onclick = e => {
// Get the buttons color value, parseInt makes sure its INT:
let color_value = parseInt(btn.getAttribute('data-colorvalue'))
// Make the R value based on color_value:
val_r = Math.round((255 * color_value) / 100)
// Make the G value based on color_value:
val_g = Math.round((255 * (100 - color_value)) / 100)
// Make the B value based on color_value:
val_b = Math.round(255 - (color_value * 1.5))
// Set the new color value plus 10.. you can play with this formula:
btn.setAttribute('data-colorvalue', color_value + 10)
// Now starts the magic...
// Make the css contents for the style element:
let css = '#btn:hover{background-color:rgb(' + val_r + ', ' + val_g + ', ' + val_b + ')}'
// If style element exists already, then lets overwrite its contents:
if (style != undefined) style.innerHTML = css
// .. however if there is none, then we must append new:
else style.appendChild(document.createTextNode(css))
// Now we simply append the style element to the head:
document.getElementsByTagName('head')[0].appendChild(style)
}
<button id="btn" data-colorvalue="1">Click me</button>