Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encode_native("transparent") is -1L instead of 16777215L #47

Open
trevorld opened this issue May 30, 2024 · 0 comments
Open

encode_native("transparent") is -1L instead of 16777215L #47

trevorld opened this issue May 30, 2024 · 0 comments

Comments

@trevorld
Copy link

trevorld commented May 30, 2024

  • I'd "expect" that "transparent" and "#FFFFFF00" would encode to the same "native" integer but instead I observe that encode_native("transparent") seems to encode to the native equivalent of "white" instead.
> library("farver")
> encode_native("transparent")
[1] -1
> encode_native("#FFFFFF00")
[1] 16777215
> encode_native("#FFFFFF00") |> decode_native()
[1] "#FFFFFF00"
> encode_native("transparent") |> decode_native()
[1] "#FFFFFF"
> encode_native("white") |> decode_native()
[1] "#FFFFFF"
> col2rgb(c("transparent", "#FFFFFF00", "white"),  
          alpha = TRUE)
      [,1] [,2] [,3]
red    255  255  255
green  255  255  255
blue   255  255  255
alpha    0    0  255
> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: America/Los_Angeles
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] farver_2.1.2

loaded via a namespace (and not attached):
[1] compiler_4.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant