Skip to content

Commit 7feccb4

Browse files
committed
Improve terminal compatibility and color scheme
1 parent 67baeac commit 7feccb4

File tree

4 files changed

+25
-29
lines changed

4 files changed

+25
-29
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "autoseed"
3-
version = "0.1.0"
3+
version = "0.1.2"
44
edition = "2024"
55
description = "A high-performance vanity address generator for Substrate-based chains"
66
license = "MIT"

src/cli/password.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::cli::terminal::{colors, terminal_codes, failed_indicator, success_indicator};
1+
use crate::cli::terminal::{colors, terminal_codes, failed_indicator};
22
use std::io::{self, Write};
33
use zeroize::Zeroize;
44

@@ -52,7 +52,7 @@ pub fn get_password_interactive() -> String {
5252
// Zeroize passwords before retry
5353
pwd1.zeroize();
5454
pwd2.zeroize();
55-
print!("{} Passwords do not match. Please try again.", failed_indicator());
55+
print!("{}", colors::red("Passwords do not match. Please try again."));
5656
io::stdout().flush().unwrap();
5757
std::thread::sleep(std::time::Duration::from_secs(2));
5858
print!("{}", terminal_codes::CR_CLEAR_LINE);
@@ -62,7 +62,7 @@ pub fn get_password_interactive() -> String {
6262
// Zeroize pwd2 as it's no longer needed
6363
pwd2.zeroize();
6464

65-
println!("{} Password confirmed.", success_indicator());
65+
println!("Wallet encryption password verified.");
6666
println!(); // Add blank line after confirmation
6767
break pwd1;
6868
}

src/cli/probability.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,10 @@ pub fn print_probability_breakdown(
286286
let pattern_len = pattern.chars().count();
287287
let locale = SystemLocale::default().unwrap();
288288

289-
println!("{}", colors::light_green("PROBABILITY CALCULATION"));
289+
println!("{}", colors::yellow("PROBABILITY CALCULATION"));
290290

291291
// Pattern Analysis
292-
println!("\n{} '{}'", colors::white("→ Pattern Analysis:"), colors::light_green(pattern));
292+
println!("\n{} '{}'", colors::yellow("→ Pattern Analysis:"), colors::bright_yellow(pattern));
293293

294294
let mut calculations = Vec::new();
295295
let mut calc_string = String::new();
@@ -342,13 +342,13 @@ pub fn print_probability_breakdown(
342342
}
343343

344344
// Base Calculation
345-
println!("\n{}", colors::white("→ Base Calculation:"));
346-
println!("{} = {}", calc_string, colors::light_green(&base_probability.to_formatted_string(&locale)));
345+
println!("\n{}", colors::yellow("→ Base Calculation:"));
346+
println!("{} = {}", calc_string, base_probability.to_formatted_string(&locale));
347347

348348
if base_probability == 1 {
349349
println!("{}", colors::green("(Pattern matches network prefix or uses only wildcards - guaranteed match!)"));
350350
} else {
351-
println!("(This is how many random addresses you'd need to check if there was only ONE position)");
351+
println!("{}", colors::gray("(This is how many random addresses you'd need to check if there was only ONE position)"));
352352
}
353353

354354
// Position Analysis
@@ -360,8 +360,8 @@ pub fn print_probability_breakdown(
360360
"Prefix Mode"
361361
};
362362

363-
println!("\n{}", colors::white(&format!("→ Position Analysis ({}):", mode_name)));
364-
println!("Address structure: [49 total characters]");
363+
println!("\n{}", colors::yellow(&format!("→ Position Analysis ({}):", mode_name)));
364+
println!("{}", colors::gray("Address structure: [49 total characters]"));
365365

366366
// Get the network prefix to check for locked positions
367367
let network_prefixes = if let Some(network) = crate::networks::find_network_by_prefix(ss58_prefix) {
@@ -476,11 +476,14 @@ pub fn print_probability_breakdown(
476476
};
477477
println!(" {}", colors::yellow(&prefix_info));
478478

479-
println!("\n Where can \"{}\" ({} chars) fit in the last {} characters?", pattern, pattern_len, within);
479+
println!("\n {}\"{}\" {}",
480+
colors::gray("Where can "),
481+
colors::bright_yellow(pattern),
482+
colors::gray(&format!("({} chars) fit in the last {} characters?", pattern_len, within)));
480483

481484
// Show positions with their individual probabilities
482485
if !positions.is_empty() {
483-
println!("\n {}", colors::white("Per-Position Probability Analysis:"));
486+
println!("\n {}", colors::yellow("Per-Position Probability Analysis:"));
484487

485488
// Check if position 0 is included (for prefix overlap detection)
486489
let has_position_zero = positions.contains(&0);
@@ -512,7 +515,7 @@ pub fn print_probability_breakdown(
512515
pos,
513516
display_prefix,
514517
".".repeat(dots_before),
515-
colors::yellow(pattern),
518+
colors::bright_yellow(pattern),
516519
"-".repeat(dashes_after),
517520
prob.to_formatted_string(&locale));
518521
}
@@ -521,7 +524,7 @@ pub fn print_probability_breakdown(
521524
pos,
522525
display_prefix,
523526
".".repeat(dots_before),
524-
colors::yellow(pattern),
527+
colors::bright_yellow(pattern),
525528
"-".repeat(dashes_after),
526529
prob.to_formatted_string(&locale));
527530
}
@@ -535,7 +538,7 @@ pub fn print_probability_breakdown(
535538

536539
// Show position probabilities for anywhere mode
537540
if !positions.is_empty() {
538-
println!("\n {}", colors::white("Per-Position Probability Analysis:"));
541+
println!("\n {}", colors::yellow("Per-Position Probability Analysis:"));
539542

540543
let has_position_zero = positions.contains(&0);
541544
let pos0_prob = if has_position_zero {
@@ -580,7 +583,7 @@ pub fn print_probability_breakdown(
580583

581584
// Show position probabilities for prefix mode
582585
if !positions.is_empty() {
583-
println!("\n {}", colors::white("Per-Position Probability Analysis:"));
586+
println!("\n {}", colors::yellow("Per-Position Probability Analysis:"));
584587

585588
for (i, &pos) in positions.iter().enumerate() {
586589
if i >= 5 && positions.len() > 6 {
@@ -611,15 +614,15 @@ pub fn print_probability_breakdown(
611614
colors::gray("Result:"), possible_positions);
612615

613616
// Final Calculation
614-
println!("\n{}", colors::white("→ FINAL CALCULATION:"));
617+
println!("\n{}", colors::yellow("→ FINAL CALCULATION:"));
615618
println!(" {}", colors::gray("─────────────────────────"));
616619

617620
let expected_attempts = if positions.is_empty() {
618621
println!("{}", colors::red("No valid positions found - pattern cannot match!"));
619622
u64::MAX
620623
} else if positions.len() == 1 {
621624
let prob = calculate_probability_at_position(pattern, positions[0], case_sensitive, ss58_prefix);
622-
println!(" Only 1 position available (position {})", positions[0]);
625+
println!(" {}", colors::gray(&format!("Only 1 position available (position {})", positions[0])));
623626
prob
624627
} else {
625628
// Multiple positions - use harmonic mean
@@ -702,10 +705,10 @@ pub fn print_probability_breakdown(
702705
format!("{:.prec$}%", percentage, prec = decimal_places)
703706
};
704707

705-
println!("\n{} Expected {} attempts {} ({})",
708+
println!("\n{} Expected {} attempts · {} ({})",
706709
colors::yellow("→ SUMMARY:"),
707-
colors::light_green(&format!("~{}", expected_attempts.to_formatted_string(&locale))),
708-
colors::gray(&format!("1 in {}", expected_attempts.to_formatted_string(&locale))),
710+
format!("~{}", expected_attempts.to_formatted_string(&locale)),
711+
format!("1 in {}", expected_attempts.to_formatted_string(&locale)),
709712
percentage_str);
710713

711714
println!();

src/cli/terminal.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ pub mod colors {
6868
text.white().to_string()
6969
}
7070

71-
pub fn light_green(text: &str) -> String {
72-
text.bright_green().to_string()
73-
}
74-
7571
}
7672

7773
/// Terminal control sequences
@@ -88,9 +84,6 @@ pub fn failed_indicator() -> String {
8884
colors::red("FAIL")
8985
}
9086

91-
pub fn success_indicator() -> String {
92-
colors::green("OK")
93-
}
9487

9588
pub fn hide_cursor() {
9689
print!("{}", terminal_codes::HIDE_CURSOR);

0 commit comments

Comments
 (0)