Fixed range check for grayscale output
This commit is contained in:
parent
387c07210e
commit
1629622bff
@ -1,7 +1,7 @@
|
|||||||
#include "iomanip.hpp"
|
#include "iomanip.hpp"
|
||||||
|
|
||||||
static std::ostream& gray(std::ostream& out, int val, int code) {
|
static std::ostream& gray(std::ostream& out, int val, int code) {
|
||||||
if (val < 0 || val > 24) {
|
if (val < 0 || val > 23) {
|
||||||
throw std::invalid_argument("gray value out of range");
|
throw std::invalid_argument("gray value out of range");
|
||||||
}
|
}
|
||||||
out << "\x1b[" << code << ";5;" << 232 + val << "m";
|
out << "\x1b[" << code << ";5;" << 232 + val << "m";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user