Skip to content

Commit

Permalink
Remove gray colour palette
Browse files Browse the repository at this point in the history
  • Loading branch information
mrob95 committed Oct 15, 2022
1 parent 293252e commit ed6ab63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
8 changes: 0 additions & 8 deletions src/flamegraph/color/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ pub enum BasicPalette {
Purple,
/// A palette in which colors are chosen from a orange spectrum.
Orange,
/// A palette in which colors are chosen from a gray spectrum.
Gray,
}

/// A semantic color palette in which different hues are used to signifiy semantic aspects of
Expand Down Expand Up @@ -233,7 +231,6 @@ impl FromStr for Palette {
"yellow" => Ok(Palette::Basic(BasicPalette::Yellow)),
"purple" => Ok(Palette::Basic(BasicPalette::Purple)),
"orange" => Ok(Palette::Basic(BasicPalette::Orange)),
"gray" => Ok(Palette::Basic(BasicPalette::Gray)),
unknown => Err(format!("unknown color palette: {}", unknown)),
}
}
Expand Down Expand Up @@ -358,11 +355,6 @@ fn rgb_components_for_palette(palette: Palette, name: &str, v1: f32, v2: f32, v3
}
BasicPalette::Aqua => color!(t!(50, 60_f32, v1), t!(165, 55_f32, v1), t!(165, 55_f32, v1)),
BasicPalette::Orange => color!(t!(190, 65_f32, v1), t!(90, 65_f32, v1), t!(0, 0_f32, v1)),
BasicPalette::Gray => color!(
t!(140, 70_f32, v1),
t!(140, 70_f32, v1),
t!(140, 70_f32, v1)
),
}
}

Expand Down
30 changes: 9 additions & 21 deletions src/flamegraph/color/palettes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub(super) mod python {
}) || name.starts_with("<")
{
// stdlib
BasicPalette::Gray
BasicPalette::Yellow
} else {
BasicPalette::Red
}
Expand Down Expand Up @@ -470,44 +470,32 @@ mod tests {
let test_names = [
TestData {
input: String::from("<frozen importlib._bootstrap>:_load_unlocked:680"),
output: BasicPalette::Green,
output: BasicPalette::Yellow,
},
TestData {
input: String::from("<built-in>:0:_SSLSocket.do_handshake"),
output: BasicPalette::Yellow,
},
TestData {
input: String::from(".venv/lib/python3.9/time.py:12"),
output: BasicPalette::Green,
output: BasicPalette::Yellow,
},
TestData {
input: String::from("C:/Users/User/AppData/Local/Programs/Python/Python39/lib/concurrent/futures/thread.py"),
output: BasicPalette::Green,
output: BasicPalette::Yellow,
},
TestData {
input: String::from("C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python39\\lib\\concurrent\\futures\\thread.py"),
output: BasicPalette::Green,
output: BasicPalette::Yellow,
},
TestData {
input: String::from("my_file.py:55"),
output: BasicPalette::Red,
},
TestData {
input: String::from(".venv/lib/python3.9/site-packages/package/file.py:12"),
output: BasicPalette::Yellow,
},
TestData {
input: String::from("native@511863:_PyFunction_Vectorcall:339"),
output: BasicPalette::Aqua,
},
TestData {
input: String::from("L339"),
output: BasicPalette::Gray,
},
TestData {
input: String::from("T339"),
output: BasicPalette::Gray,
},
TestData {
input: String::from("P339"),
output: BasicPalette::Gray,
},
];

for item in test_names.iter() {
Expand Down

0 comments on commit ed6ab63

Please sign in to comment.