Add address color dots and cached ENS reverse lookups
Some checks failed
check / check (push) Has been cancelled
Some checks failed
check / check (push) Has been cancelled
Deterministic colored dots derived from address bytes (16-color palette) displayed before every address. ENS reverse resolution for transaction counterparties with 12-hour localStorage cache.
This commit is contained in:
@@ -99,6 +99,35 @@ function balanceLinesForAddress(addr) {
|
||||
return html;
|
||||
}
|
||||
|
||||
const ADDRESS_COLORS = [
|
||||
"#e6194b",
|
||||
"#3cb44b",
|
||||
"#4363d8",
|
||||
"#f58231",
|
||||
"#911eb4",
|
||||
"#42d4f4",
|
||||
"#f032e6",
|
||||
"#bfef45",
|
||||
"#fabed4",
|
||||
"#469990",
|
||||
"#dcbeff",
|
||||
"#9a6324",
|
||||
"#800000",
|
||||
"#aaffc3",
|
||||
"#808000",
|
||||
"#000075",
|
||||
];
|
||||
|
||||
function addressColor(address) {
|
||||
const idx = parseInt(address.slice(2, 6), 16) % 16;
|
||||
return ADDRESS_COLORS[idx];
|
||||
}
|
||||
|
||||
function addressDotHtml(address) {
|
||||
const color = addressColor(address);
|
||||
return `<span style="width:8px;height:8px;border-radius:50%;display:inline-block;background:${color};margin-right:4px;vertical-align:middle;flex-shrink:0;"></span>`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
$,
|
||||
showError,
|
||||
@@ -106,4 +135,6 @@ module.exports = {
|
||||
showView,
|
||||
showFlash,
|
||||
balanceLinesForAddress,
|
||||
addressColor,
|
||||
addressDotHtml,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user