Example theme change

This commit is contained in:
2024-05-10 19:49:21 +03:00
parent 4b16b74d15
commit 9d92dfd145
2 changed files with 17 additions and 0 deletions

View File

@@ -11,6 +11,21 @@
btn.addEventListener('click', function() {
appState.onTokenReceived('token123');
})
let colorChangeBtnRed = document.getElementById('colorChangeBtnRed');
colorChangeBtnRed.addEventListener('click', function() {
var hexColor = '#FF0000'.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i
, (m, r, g, b) => '#ff' + r + r + g + g + b + b).substring(1);
var numColor = parseInt(hexColor, 16);
appState.changeColor(numColor)
})
let colorChangeBtnBlue = document.getElementById('colorChangeBtnBlue');
colorChangeBtnBlue.addEventListener('click', function() {
var hexColor = '#0000FF'.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i
, (m, r, g, b) => '#ff' + r + r + g + g + b + b).substring(1);
var numColor = parseInt(hexColor, 16);
appState.changeColor(numColor)
})
}
}());