hneth / unikn

Enabling corporate design elements in R (with colors and color-related functions)
38 stars 6 forks source link

Size of Hex code in seecol() is too small to read #6

Closed GitHunter0 closed 3 years ago

GitHunter0 commented 3 years ago

unikn is a fantastic package. I'm just having trouble with the small size of hex code in seecol(), which is too small to read when displaying 14 or more colors. Here an example:

library(unikn)
library(magrittr)
unikn::usecol(c("black","blue","white"), n=14) %>% unikn::seecol(hex=TRUE)

image

I hope there is a workaround to that. Thank you

hneth commented 3 years ago

Thanks for raising a good and valid issue!

The display size of the HEX codes was really re-scaled too conservatively. I've now modified this and let seecol() print the HEX values on two alternative lines when they get too long to fit on one line.

Perhaps you could out the in the current development version (unikn version 0.3.0.9009) and let me know what you think?

library(unikn)
library(magrittr)
unikn::usecol(c("black","blue3","white"), n= 8) %>% unikn::seecol(hex = TRUE)
unikn::usecol(c("black","blue3","white"), n=12) %>% unikn::seecol(hex = TRUE)
unikn::usecol(c("black","blue3","white"), n=20) %>% unikn::seecol(hex = TRUE)

Best, Hans

GitHunter0 commented 3 years ago

Hey @hneth , I appreciate the quick response. I re-tested: unikn::usecol(c("black","blue3","white"), n=14) %>% unikn::seecol(hex = TRUE) image It is getting better but I think it is still very small and the RGB colors disappear (unless rgb=TRUE) even with apparent enough space. Would it be possible to just adjust font size to be bigger when number of colors increases? Thank you

hneth commented 3 years ago

Hi again ~~

thanks for your test and the image. Obviously the fonts scale very differently on different systems: When I ran your examples, the size of the HEX codes was much larger. Hopefully, a few additional tweaks should fix this. When I now run

unikn::usecol(c("black","blue3","white"), n=12) %>% unikn::seecol(hex = TRUE)

I get

image

The display size of the HEX codes is now set to the maximum of HEX and RGB codes (which may still get a bit tricky if both parameters get very small). Additionally, when the HEX codes no longer fit on 2 lines, they are shown diagonally, see:

unikn::usecol(c("black","blue3","white"), n=25) %>% unikn::seecol(hex = TRUE)

Does this work fine on your machine as well?

Best, Hans

GitHunter0 commented 3 years ago

Hey man, I tried on a Windows machine, and now it is working perfectly. Thanks!