fix: bitwise representation for RGB highlight (#13188)

Co-authored-by: Nik Revenco <154856872+NikitaRevenco@users.noreply.github.com>
pull/13954/head
Nik Revenco 2025-07-12 16:11:31 +01:00 committed by GitHub
parent ca7479ca88
commit e844a4365d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -300,7 +300,7 @@ impl Theme {
/// Interpret a Highlight with the RGB foreground /// Interpret a Highlight with the RGB foreground
fn decode_rgb_highlight(highlight: Highlight) -> Option<(u8, u8, u8)> { fn decode_rgb_highlight(highlight: Highlight) -> Option<(u8, u8, u8)> {
(highlight.get() > Self::RGB_START).then(|| { (highlight.get() > Self::RGB_START).then(|| {
let [b, g, r, ..] = (highlight.get() + 1).to_ne_bytes(); let [b, g, r, ..] = (highlight.get() + 1).to_le_bytes();
(r, g, b) (r, g, b)
}) })
} }
@ -309,7 +309,7 @@ impl Theme {
pub fn rgb_highlight(r: u8, g: u8, b: u8) -> Highlight { pub fn rgb_highlight(r: u8, g: u8, b: u8) -> Highlight {
// -1 because highlight is "non-max": u32::MAX is reserved for the null pointer // -1 because highlight is "non-max": u32::MAX is reserved for the null pointer
// optimization. // optimization.
Highlight::new(u32::from_ne_bytes([b, g, r, u8::MAX]) - 1) Highlight::new(u32::from_le_bytes([b, g, r, u8::MAX]) - 1)
} }
#[inline] #[inline]