Example theme change
This commit is contained in:
@@ -42,6 +42,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button id='token'>Token btn</button>
|
<button id='token'>Token btn</button>
|
||||||
|
<button id='colorChangeBtnRed'>Color btn Red</button>
|
||||||
|
<button id='colorChangeBtnBlue'>Color btn Blue</button>
|
||||||
<section class='contents'>
|
<section class='contents'>
|
||||||
<article>
|
<article>
|
||||||
<div id="flutter_target"></div>
|
<div id="flutter_target"></div>
|
||||||
|
|||||||
@@ -12,5 +12,20 @@
|
|||||||
appState.onTokenReceived('token123');
|
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)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
Reference in New Issue
Block a user