Skip to content

Commit

Permalink
feat: update to qualpal 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jolars committed Jun 10, 2024
1 parent cb75367 commit 2254612
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/qualpal/color_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ colorGrid(const std::array<double, 2>& h_lim,
for (const auto& h : h_vec) {
for (const auto& s : s_vec) {
for (const auto& l : l_vec) {
// We allow negative hues to wrap around the color wheel, but here we
// need to make sure that the hue is in the range [0, 360)
if (h < 0) {
colors.emplace_back(h + 360, s, l);
}

colors.emplace_back(h, s, l);
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/qualpal/qualpal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ qualpal(const int n,
"than the number of points in the color grid");
}

if (h_lim[0] < 0 || h_lim[1] > 360) {
throw std::invalid_argument("Hue must be between 0 and 360");
if (h_lim[0] < -360 || h_lim[1] > 360) {
throw std::invalid_argument("Hue must be between -360 and 360");
}

if (h_lim[1] - h_lim[0] > 360) {
throw std::invalid_argument("Hue range must be less than 360");
}

if (s_lim[0] < 0 || s_lim[1] > 1) {
Expand Down

0 comments on commit 2254612

Please sign in to comment.