aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Martin Winterstein <Shizukesa4@gmail.com>2018-10-07 15:10:58 -0600
committerChristian Duerr <chrisduerr@users.noreply.github.com>2018-10-07 21:10:58 +0000
commitd2ed0152f1a48bec3b84e5602944221ddf13071f (patch)
tree5af3bc6f425e3b039c1a381a4e4d1ff685df0f6e
parent36920fb07184df5962b017d63b8b97cbdc25dcbe (diff)
downloadalacritty-d2ed0152f1a48bec3b84e5602944221ddf13071f.tar.gz
alacritty-d2ed0152f1a48bec3b84e5602944221ddf13071f.zip
fix erroneous indexed_color results
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/term/color.rs17
2 files changed, 9 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac29fb06..155cb5ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Fixed
+- Fixed erroneous results when using the `indexed_colors` config option
+
## Version 0.2.1
### Added
diff --git a/src/term/color.rs b/src/term/color.rs
index 276a6897..0706f9df 100644
--- a/src/term/color.rs
+++ b/src/term/color.rs
@@ -101,24 +101,19 @@ impl List {
for r in 0..6 {
for g in 0..6 {
for b in 0..6 {
- // Index of the color is number of named colors + rgb
- let color_index = 16 + r + g + b;
-
// Override colors 16..232 with the config (if present)
if let Some(indexed_color) = colors
.indexed_colors
.iter()
- .find(|ic| ic.index == color_index)
+ .find(|ic| ic.index == index as u8)
{
self[index] = indexed_color.color;
- index += 1;
- continue;
+ } else {
+ self[index] = Rgb { r: if r == 0 { 0 } else { r * 40 + 55 },
+ b: if b == 0 { 0 } else { b * 40 + 55 },
+ g: if g == 0 { 0 } else { g * 40 + 55 },
+ };
}
-
- self[index] = Rgb { r: if r == 0 { 0 } else { r * 40 + 55 },
- b: if b == 0 { 0 } else { b * 40 + 55 },
- g: if g == 0 { 0 } else { g * 40 + 55 },
- };
index += 1;
}
}