Skip to content

Commit

Permalink
Fix loadPaletteGrayscale()
Browse files Browse the repository at this point in the history
Currently, `loadPaletteGrayscale()` is broken. It returns a palette containing `[(0, 0, 0)x255, (1, 1, 1)]`. If you use any number of steps other the default 256 steps, you don't even get the `(1, 1, 1)`.
  • Loading branch information
Hi02hi authored and ftsf committed Jul 9, 2024
1 parent 2049233 commit 99d6023
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nico.nim
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ proc loadPalettePico8Extra*(): Palette =
proc loadPaletteGrayscale*(steps: range[1..256] = 256): Palette =
## loads grayscale palette with specified number of steps
for i in 0..<steps:
let v = floor(i.float32 / 255f).int
let v = floor((i / steps) * 256.0).int
result.data[i] = RGB(v,v,v)
result.size = steps

Expand Down

0 comments on commit 99d6023

Please sign in to comment.