mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-06-20 22:02:11 +02:00
made colors same as anigma
total 8 colors with same logic as anigma
This commit is contained in:
parent
481b0b41b8
commit
f24e5adec3
@ -316,7 +316,7 @@ class EventData {
|
|||||||
|
|
||||||
|
|
||||||
int effectiveNameFieldLen = gNameLengthInPost + 3; // get this before name is mangled by color
|
int effectiveNameFieldLen = gNameLengthInPost + 3; // get this before name is mangled by color
|
||||||
String nameColor = getNameColor(name);
|
String nameColor = getNameColor(pubkey);
|
||||||
|
|
||||||
// odd len names need an extra dash
|
// odd len names need an extra dash
|
||||||
// if( name.length %2 == 1 ) name = name + nameInside;
|
// if( name.length %2 == 1 ) name = name + nameInside;
|
||||||
@ -425,7 +425,7 @@ class EventData {
|
|||||||
|
|
||||||
// get name in color and pad it too
|
// get name in color and pad it too
|
||||||
String nameToPrint = name.padLeft(nameWidth).substring(0, nameWidth);
|
String nameToPrint = name.padLeft(nameWidth).substring(0, nameWidth);
|
||||||
nameToPrint = getStrInColor(nameToPrint, getNameColor(name));
|
nameToPrint = getStrInColor(nameToPrint, getNameColor(pubkey));
|
||||||
|
|
||||||
String dateToPrint = strDate.padLeft(gSpacesPerDepth * timeWidthDepth).substring(0, gSpacesPerDepth * timeWidthDepth);
|
String dateToPrint = strDate.padLeft(gSpacesPerDepth * timeWidthDepth).substring(0, gSpacesPerDepth * timeWidthDepth);
|
||||||
|
|
||||||
|
@ -137,17 +137,42 @@ String gWarningColor = redColor; // red
|
|||||||
const String gColorEndMarker = "\x1B[0m";
|
const String gColorEndMarker = "\x1B[0m";
|
||||||
|
|
||||||
// blue is too bright
|
// blue is too bright
|
||||||
|
/*
|
||||||
|
e & f are red
|
||||||
|
c & d are pink
|
||||||
|
a & b are orange
|
||||||
|
8 & 9 are yellow
|
||||||
|
6 & 7 are green
|
||||||
|
4 & 5 are light blue
|
||||||
|
2 & 3 are blue
|
||||||
|
0 & 1 are purple
|
||||||
|
|
||||||
|
|
||||||
List<String> nameColorPalette = [brightGreenColor, brightCyanColor, brightYellowColor, brightMagentaColor,
|
List<String> nameColorPalette = [brightGreenColor, brightCyanColor, brightYellowColor, brightMagentaColor,
|
||||||
brightBlueColor, brightRedColor, brightBlackColor, brightWhiteColor,
|
brightBlueColor, brightRedColor, brightBlackColor, brightWhiteColor,
|
||||||
yellowColor, magentaColor, redColor ];
|
yellowColor, magentaColor, redColor ];
|
||||||
|
*/
|
||||||
|
|
||||||
|
Map<String, String> pubkeyColor = { '0': brightMagentaColor, '1': brightMagentaColor,
|
||||||
|
'2': brightBlueColor, '3': brightBlueColor,
|
||||||
|
'4': brightCyanColor, '5': brightCyanColor,
|
||||||
|
'6': brightGreenColor, '7': brightGreenColor,
|
||||||
|
'8': brightYellowColor,'9': brightYellowColor,
|
||||||
|
'a': brightRedColor, 'b': brightRedColor,
|
||||||
|
'c': yellowColor, 'd': yellowColor,
|
||||||
|
'e': redColor, 'f': redColor
|
||||||
|
};
|
||||||
|
|
||||||
|
List<String> nameColorPalette = [brightMagentaColor, brightBlueColor, brightCyanColor, brightGreenColor,
|
||||||
|
brightYellowColor, brightRedColor, yellowColor, redColor ];
|
||||||
|
|
||||||
|
|
||||||
String getNameColor( String name) {
|
String getNameColor( String pubkey) {
|
||||||
if( name.length == 0)
|
if( pubkey.length == 0)
|
||||||
return nameColorPalette[0];
|
return nameColorPalette[0];
|
||||||
|
|
||||||
int offset = name.substring(0, 1).toLowerCase().codeUnits[0] % nameColorPalette.length;
|
String firstChar = pubkey.substring(0, 1).toLowerCase();
|
||||||
return nameColorPalette[offset];
|
return pubkeyColor[firstChar]??brightMagentaColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user