mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 19:26:09 +00:00
Fix assert for 256 colors
This commit is contained in:
parent
4de8bd7363
commit
6f072ac894
@ -98,14 +98,17 @@ impl Color {
|
|||||||
Color::Rgb(value, value, value)
|
Color::Rgb(value, value, value)
|
||||||
} else {
|
} else {
|
||||||
let n = n - 16;
|
let n = n - 16;
|
||||||
|
// We support 6*6*6 = 216 colors here
|
||||||
|
assert!(n < 216);
|
||||||
|
|
||||||
let r = n / 36;
|
let r = n / 36;
|
||||||
let g = (n % 36) / 6;
|
let g = (n % 36) / 6;
|
||||||
let b = n % 6;
|
let b = n % 6;
|
||||||
|
|
||||||
assert!(r < 5);
|
// Each color is in the range [0, 5] (6 possible values)
|
||||||
assert!(g < 5);
|
assert!(r < 6);
|
||||||
assert!(b < 5);
|
assert!(g < 6);
|
||||||
|
assert!(b < 6);
|
||||||
|
|
||||||
Color::RgbLowRes(r, g, b)
|
Color::RgbLowRes(r, g, b)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user