sckott / cowsay

cowsay w/ more animals, in R
https://sckott.github.io/cowsay/
Other
310 stars 49 forks source link

Simplifying color argument #85

Open ecrs98 opened 1 year ago

ecrs98 commented 1 year ago

Hey Scott,

Just wondering, would it be possible to add functionality to say() that would allow for a single color argument? Having separate arguments for what_color and by_color is necessary. Most of the time, though, I specify these to be the same color. It would be nice to specify color = "blue", for example, and have that be equivalent to what_color = "blue", by_color = "blue".

Love the package by the way. Makes my coding work flow a little more fun :-)


thanks!


\   ^__^ 
 \  (oo)\ ________ 
    (__)\         )\ /\ 
         ||------w|
         ||      ||

--Ethan

sckott commented 1 year ago

Thanks for your issue @ecrs98 ! I'm so glad it makes coding more fun.

What do you think @aedobbyn ? Does this seem like a good idea, and if so, can it be done easily?

sckott commented 1 year ago

@ecrs98 let's wait a bit to see if amanda responds. if not soon, we can move ahead discussing this

aedobbyn commented 1 year ago

hi, so glad you like the package! so my first instinct here is that it would be possible to do of course, but that this argument would be redundant given that it's covered by the other two already there so i don't love it design-wise. what do you think @sckott?

sckott commented 1 year ago

Thanks @aedobbyn ! One idea is we could do in the function definition

say <- function(what="Hello world!", by="cat",
                type=NULL,
                what_color=NULL, by_color=what_color, <--------- 
                length=18, fortune=NULL, ...) 

Where we set by_color to be whatever is set in what_color UNLESS by_color is set to something by the user. NULL is still the default for by_color here.

I agree I don't think we should add a new parameter.