small fixes and improvements

This commit is contained in:
InsanusMokrassar 2023-09-25 16:28:49 +06:00
parent 48d1077ce4
commit 8f80b7e066

View File

@ -172,12 +172,15 @@ fun main() {
updateText()
} ?: window.alert("Unable to load body")
document.body ?.appendElement("p", {})
document.body ?.appendElement("button") {
fun updateHeaderColor() {
val (r, g, b) = Random.nextUBytes(3)
val hex = Color.Hex("#${r.toString(16)}${g.toString(16)}${b.toString(16)}")
webApp.setHeaderColor(hex)
(this as? HTMLButtonElement) ?.style ?.backgroundColor = hex.value
textContent = hex.value
}
addEventListener("click", {
updateHeaderColor()