mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-03 04:34:21 -05:00
fix erroneous indexed_color results
This commit is contained in:
parent
36920fb071
commit
d2ed0152f1
2 changed files with 9 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue