mirror of
https://github.com/seigler/dash-visualizer
synced 2025-07-26 01:06:12 +00:00
Remove monotone color scheme, add console messages
This commit is contained in:
parent
4fdab8ed2f
commit
96a5f901b5
1 changed files with 22 additions and 9 deletions
|
@ -70,16 +70,27 @@ var App = {
|
|||
|
||||
function generateColors(blockHash) {
|
||||
// https://github.com/c0bra/color-scheme-js
|
||||
const schemeTypes = ['mono', 'contrast', 'triade', 'tetrade', 'analogic'];
|
||||
var blockColorScheme = new ColorScheme();
|
||||
blockColorScheme.from_hue(
|
||||
Math.floor(parseInt(prevBlockHash.slice(-3), 16) / 4096 * 360)
|
||||
).scheme(
|
||||
schemeTypes[
|
||||
Math.floor(parseInt(prevBlockHash.slice(-5, -3), 16) / 256 * schemeTypes.length)
|
||||
]
|
||||
const schemeTypes = [
|
||||
'contrast',
|
||||
'triade',
|
||||
'triade',
|
||||
'tetrade',
|
||||
'tetrade',
|
||||
'analogic',
|
||||
'analogic',
|
||||
'analogic',
|
||||
'analogic',
|
||||
];
|
||||
const hue = Math.floor(
|
||||
parseInt(prevBlockHash.slice(-3), 16) / 4096 * 360
|
||||
);
|
||||
return blockColorScheme.colors();
|
||||
const schemeFraction = parseInt(prevBlockHash.slice(-5, -3), 16) / 256;
|
||||
const scheme = schemeTypes[Math.floor(schemeFraction * schemeTypes.length)];
|
||||
var blockColorScheme = new ColorScheme();
|
||||
blockColorScheme.from_hue(hue).scheme(scheme).add_complement(true);
|
||||
const colors = blockColorScheme.colors();
|
||||
console.log('New color scheme: ' + scheme + ' based on %chue ' + hue, 'background-color:hsl('+hue+',100%,50%)');
|
||||
return colors;
|
||||
};
|
||||
|
||||
var onBlock = function(data) {
|
||||
|
@ -131,6 +142,8 @@ var App = {
|
|||
]
|
||||
};
|
||||
|
||||
console.log('tx: '+tx.value+(tx.private?' private':'')+(tx.instant?' instant':''));
|
||||
|
||||
var paint = document.createElement('div');
|
||||
paint.classList.add('paint');
|
||||
paint.style.maskImage = 'url(assets/paint/' + (tx.value > 10 ?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue