File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 11use crate :: game:: ascii_digits:: get_digit_patterns;
22use crate :: game:: ascii_rank_titles_generated:: get_rank_title_display;
3- use crate :: scoring:: { ScoringEngine , TypingMetrics } ;
3+ use crate :: scoring:: { RankingTitle , ScoringEngine , TypingMetrics } ;
44use crate :: sharing:: { SharingPlatform , SharingService } ;
55use crate :: Result ;
66use crossterm:: {
@@ -169,7 +169,12 @@ impl ResultScreen {
169169 } else if metrics. was_skipped {
170170 execute ! ( stdout, SetForegroundColor ( Color :: DarkGrey ) ) ?;
171171 } else {
172- execute ! ( stdout, SetForegroundColor ( Color :: Green ) ) ?;
172+ execute ! (
173+ stdout,
174+ SetForegroundColor (
175+ RankingTitle :: for_score( metrics. challenge_score) . terminal_color( )
176+ )
177+ ) ?;
173178 }
174179 execute ! ( stdout, Print ( line) ) ?;
175180 execute ! ( stdout, ResetColor ) ?;
@@ -421,7 +426,9 @@ impl ResultScreen {
421426 execute ! (
422427 stdout,
423428 SetAttribute ( Attribute :: Bold ) ,
424- SetForegroundColor ( Color :: Green )
429+ SetForegroundColor (
430+ RankingTitle :: for_score( session_metrics. challenge_score) . terminal_color( )
431+ )
425432 ) ?;
426433 execute ! ( stdout, Print ( line) ) ?;
427434 execute ! ( stdout, ResetColor ) ?;
Original file line number Diff line number Diff line change @@ -27,6 +27,18 @@ impl RankingTier {
2727 RankingTier :: Legendary => "fire" ,
2828 }
2929 }
30+
31+ /// Get the terminal color for this tier
32+ pub fn terminal_color ( & self ) -> crossterm:: style:: Color {
33+ use crossterm:: style:: Color ;
34+ match self {
35+ RankingTier :: Beginner => Color :: Cyan ,
36+ RankingTier :: Intermediate => Color :: Blue ,
37+ RankingTier :: Advanced => Color :: Green ,
38+ RankingTier :: Expert => Color :: Yellow ,
39+ RankingTier :: Legendary => Color :: Red ,
40+ }
41+ }
3042}
3143
3244impl RankingTitle {
@@ -63,6 +75,11 @@ impl RankingTitle {
6375 self . tier . color_palette ( )
6476 }
6577
78+ /// Get the terminal color for this ranking title
79+ pub fn terminal_color ( & self ) -> crossterm:: style:: Color {
80+ self . tier . terminal_color ( )
81+ }
82+
6683 /// Get all ranking titles in order from lowest to highest score (matches engine.rs exactly)
6784 pub fn all_titles ( ) -> Vec < RankingTitle > {
6885 vec ! [
You can’t perform that action at this time.
0 commit comments