From 9088498afe8c89e54804790d404d9f990a7cfa44 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Thu, 11 Sep 2025 12:21:52 +0200 Subject: [PATCH] chore: colors for subject and authority key id --- ui/src/main.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/ui/src/main.rs b/ui/src/main.rs index 429799f..b1b131b 100644 --- a/ui/src/main.rs +++ b/ui/src/main.rs @@ -572,7 +572,13 @@ impl Ui { .align_y(alignment::Vertical::Center), row![ text("Subject-Key-Id: ").width(160), - monospace_text(cert.subject_key_id().to_string()), + monospace_text(cert.subject_key_id().to_string()).style(move |_| { + if idx == 0 { + text::Style::default() + } else { + self.get_cert_key_style(idx as u8 - 1) + } + }), text(" "), if idx == 0 { container(text("")) @@ -588,7 +594,13 @@ impl Ui { ], row![ text("Authority-Key-Id: ").width(160), - monospace_text(cert.authority_key_id().to_string()), + monospace_text(cert.authority_key_id().to_string()).style(move |_| { + if idx >= chain.certs().len() - 1 { + text::Style::default() + } else { + self.get_cert_key_style(idx as u8) + } + }), text(" "), if idx >= chain.certs().len() - 1 { container(text("")) @@ -1046,6 +1058,16 @@ Authority-Key-Id: {} ..container::Style::default() } } + + fn get_cert_key_style(&self, idx: u8) -> text::Style { + text::Style { + color: if self.wrong_chain_certificate_indexes().contains(&idx) { + Some(color!(0xaa0000)) + } else { + text::Style::default().color + } + } + } } #[derive(Debug, Clone)]