forked from polkadot-js/apps
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
20 lines (15 loc) · 785 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright 2017-2021 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { chainColors, nodeColors } from './colors';
import { identityNodes } from './identityIcons';
export * from './logos';
function sanitize (value?: string): string {
return value?.toLowerCase().replace('-', ' ') || '';
}
export function getSystemIcon (systemName: string): 'beachball' | 'polkadot' | 'substrate' {
return (identityNodes[systemName.toLowerCase().replace(/-/g, ' ')] || 'substrate') as 'substrate';
}
export function getSystemChainColor (systemChain: string, systemName: string): string | undefined {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return chainColors[sanitize(systemChain)] || nodeColors[sanitize(systemName)];
}