matt-dray / pixeltrix

:space_invader::computer_mouse: R package: make pixel art interactively in a plot window, get a matrix, make a gif
Other
21 stars 0 forks source link

feature request: output colours used in click_pixels() #17

Closed TimTaylor closed 1 year ago

TimTaylor commented 1 year ago

Not quite #14. It would be nice if click_pixels() returned the colours used in the output just above the image matrix.

matt-dray commented 1 year ago

Thanks Tim! Would a named-vector attribute be useful? I've got something like this on the go:

> click_pixels(3, 3, 3, colours = c("red", "blue, "yellow"))
Click squares in the plot window. Press <Esc> to end.

Then after clicking squares and pressing Esc:

     [,1] [,2] [,3]
[1,]    1    0    1
[2,]    0    2    0
[3,]    1    0    1
attr(,"colours")
       0        1        2 
   "red"   "blue" "yellow" 
TimTaylor commented 1 year ago

Aye - that's perfect.