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

Unable to use Sass built in color module #121

Closed
yogat3ch opened this issue Dec 15, 2022 · 2 comments
Closed

Unable to use Sass built in color module #121

yogat3ch opened this issue Dec 15, 2022 · 2 comments

Comments

@yogat3ch
Copy link

This might also be a feature request depending on how you look at it?

Describe the problem

The sass:color module appears to be unsupported by the package at present:

require("sass")
#> Loading required package: sass
 sass::sass(
   "@use 'sass:color';
   .class {
     color: adjust-color(#23fe45, $whiteness: 30%);  
       }
   "
 )
#> Error in compile_data(sass_input, options): Error: Function adjust-color has no parameter named $whiteness
#>         on line 3:35 of stdin
#> >>      color: adjust-color(#23fe45, $whiteness: 30);  
#> 
#>    ----------------------------------^
 sass::sass(
   "@use 'sass:color';
   .class {
     color: color.adjust(#23fe45, $whiteness: 30%);  
       }
   "
 )
#> Error in compile_data(sass_input, options): Error: Invalid CSS after "...   color: color": expected expression (e.g. 1px, bold), was ".adjust(#23fe45, $w"
#>         on line 3:18 of stdin
#> >>      color: color.adjust(#23fe45, $whiteness: 30);  
#> 
#>    -----------------^

Created on 2022-12-15 with reprex v2.0.2

Session Info


─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.1 (2022-06-23)
 os       macOS Ventura 13.0.1
 system   aarch64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/New_York
 date     2022-12-15
 rstudio  2022.07.2+576 Spotted Wakerobin (desktop)
 pandoc   2.19.2 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/tools/ (via rmarkdown)

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.2.0)
P attempt 0.3.1 2020-05-03 [?] CRAN (R 4.2.0)
BOR 0.2.1 2022-12-13 [1] Github (Martin-McCoy/BOR@a876853)
brio 1.1.3 2021-11-30 [1] CRAN (R 4.2.0)
P bs4Dash 2.1.0 2022-10-20 [?] Github (yogat3ch/bs4Dash@4494684)
P cachem 1.0.6 2021-08-19 [?] CRAN (R 4.2.0)
callr 3.7.2 2022-08-22 [1] CRAN (R 4.2.0)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.2.0)
cicerone 1.0.5.9000 2022-10-18 [1] Github (JohnCoene/cicerone@1f28ea4)
P cli 3.4.1 2022-09-23 [?] CRAN (R 4.2.0)
clipr 0.8.0 2022-02-22 [1] CRAN (R 4.2.0)
colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.0)
config 0.3.1 2020-12-17 [1] CRAN (R 4.2.0)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.0)
crssDB 0.7.0 2022-12-14 [1] Github (Martin-McCoy/crssDB@91f04be)
curl 4.3.3 2022-10-06 [1] CRAN (R 4.2.1)
P DBI 1.1.3 2022-06-18 [?] CRAN (R 4.2.0)
P dbplyr 2.2.1 2022-06-27 [?] CRAN (R 4.2.0)
desc 1.4.2 2022-09-08 [1] CRAN (R 4.2.0)
P devtools 2.4.5 2022-10-11 [?] CRAN (R 4.2.0)
digest 0.6.30 2022-10-18 [1] CRAN (R 4.2.1)
P dplyr 1.0.10 2022-09-01 [?] CRAN (R 4.2.0)
echarts4r 0.4.4 2022-05-28 [1] CRAN (R 4.2.0)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.0)
evaluate 0.17 2022-10-07 [1] CRAN (R 4.2.0)
P fansi 1.0.3 2022-03-24 [?] CRAN (R 4.2.0)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0)
P fs 1.5.2 2021-12-08 [?] CRAN (R 4.2.0)
P gargle 1.2.1 2022-09-08 [?] CRAN (R 4.2.0)
generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.0)
P glue 1.6.2 2022-02-24 [?] CRAN (R 4.2.0)
golem 0.3.5 2022-10-18 [1] CRAN (R 4.2.1)
googledrive 2.0.0 2021-07-08 [1] CRAN (R 4.2.0)
P googlesheets4 1.0.1 2022-08-13 [?] CRAN (R 4.2.0)
highr 0.9 2021-04-16 [1] CRAN (R 4.2.0)
htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.0)
htmlwidgets 1.5.4 2021-09-08 [1] CRAN (R 4.2.0)
httpuv 1.6.6 2022-09-08 [1] CRAN (R 4.2.0)
P jsonlite 1.8.4 2022-12-06 [?] CRAN (R 4.2.1)
knitr 1.40 2022-08-24 [1] CRAN (R 4.2.0)
P labeling 0.4.2 2020-10-20 [?] CRAN (R 4.2.0)
later 1.3.0 2021-08-18 [1] CRAN (R 4.2.0)
VP lifecycle 1.0.2 2022-10-07 [?] CRAN (R 4.2.1) (on disk 1.0.3)
P lubridate 1.8.0 2021-10-07 [?] CRAN (R 4.2.0)
P magrittr 2.0.3 2022-03-30 [?] CRAN (R 4.2.0)
P memoise 2.0.1 2021-11-26 [?] CRAN (R 4.2.0)
mime 0.12 2021-09-28 [1] CRAN (R 4.2.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.0)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0)
P pillar 1.8.1 2022-08-19 [?] CRAN (R 4.2.0)
pkgbuild 1.3.1 2021-12-20 [1] CRAN (R 4.2.0)
P pkgconfig 2.0.3 2019-09-22 [?] CRAN (R 4.2.0)
pkgload 1.3.0 2022-06-27 [1] CRAN (R 4.2.0)
P plyr 1.8.7 2022-03-24 [?] CRAN (R 4.2.0)
P pool 0.1.6 2021-01-14 [?] CRAN (R 4.2.0)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.0)
processx 3.7.0 2022-07-07 [1] CRAN (R 4.2.0)
profvis 0.3.7 2020-11-02 [1] CRAN (R 4.2.0)
promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.0)
ps 1.7.1 2022-06-18 [1] CRAN (R 4.2.0)
P purrr 0.3.5 2022-10-06 [?] CRAN (R 4.2.1)
P R6 2.5.1 2021-08-19 [?] CRAN (R 4.2.0)
P Rcpp 1.0.9 2022-07-08 [?] CRAN (R 4.2.0)
reactable 0.3.0 2022-05-26 [1] CRAN (R 4.2.0)
P remotes 2.4.2 2021-11-30 [?] CRAN (R 4.2.0)
renv 0.16.0 2022-09-29 [1] CRAN (R 4.2.1)
P reprex 2.0.2 2022-08-17 [?] CRAN (R 4.2.0)
R RiverViz * 0.0.0.9002 [?]
P rlang 1.0.6 2022-09-24 [?] CRAN (R 4.2.0)
P rmarkdown 2.17 2022-10-07 [?] CRAN (R 4.2.0)
RMySQL 0.10.24 2022-10-18 [1] CRAN (R 4.2.1)
roxygen2 7.2.1 2022-07-18 [1] CRAN (R 4.2.0)
rprojroot 2.0.3 2022-04-02 [1] CRAN (R 4.2.0)
P rstudioapi 0.14 2022-08-22 [?] CRAN (R 4.2.0)
sass 0.4.3.9000 2022-12-15 [1] Github (rstudio/sass@3e61ef8)
scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.0)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
P shiny 1.7.2 2022-07-19 [?] CRAN (R 4.2.0)
shinyjs 2.1.0 2021-12-23 [1] CRAN (R 4.2.0)
shinyVirga 0.6.1 2022-12-14 [1] Github (Martin-McCoy/shinyVirga@eea3704)
P snakecase 0.11.0 2019-05-25 [?] CRAN (R 4.2.0)
stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.0)
P stringr 1.4.1 2022-08-20 [?] CRAN (R 4.2.0)
P testthat * 3.1.5 2022-10-08 [?] CRAN (R 4.2.0)
P tibble 3.1.8 2022-07-22 [?] CRAN (R 4.2.0)
P tidyr 1.2.1 2022-09-08 [?] CRAN (R 4.2.1)
tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.1)
tippy 1.0.0 2022-12-07 [1] Github (JohnCoene/tippy@c3c3a2a)
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.0)
usethis 2.1.6 2022-05-25 [1] CRAN (R 4.2.0)
P utf8 1.2.2 2021-07-24 [?] CRAN (R 4.2.0)
UU 1.5.4 2022-12-08 [1] Github (yogat3ch/UU@dfae840)
P vctrs 0.4.2 2022-09-29 [?] CRAN (R 4.2.0)
virgaUtils 0.4.0 2022-12-14 [1] Github (Martin-McCoy/virgaUtils@6ae5e01)
withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0)
xfun 0.33 2022-09-12 [1] CRAN (R 4.2.0)
xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.0)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.0)
yaml 2.3.6 2022-10-18 [1] CRAN (R 4.2.1)

[1] /Users/stephenholsenbeck/Documents/R/Contributor_Repos/VirgaLabs/RiverViz/renv/library/R-4.2/aarch64-apple-darwin20
[2] /Users/stephenholsenbeck/Documents/R/Contributor_Repos/VirgaLabs/RiverViz/renv/sandbox/R-4.2/aarch64-apple-darwin20/84ba8b13

V ── Loaded and on-disk version mismatch.
P ── Loaded and on-disk path mismatch.
R ── Package was removed from disk.

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@yogat3ch yogat3ch changed the title Unable to use Sass built in modules Unable to use Sass built in color modules Dec 15, 2022
@yogat3ch yogat3ch changed the title Unable to use Sass built in color modules Unable to use Sass built in color module Dec 15, 2022
@cpsievert
Copy link
Contributor

Currently {sass} uses LibSass under the hood, but those docs are primarily written with Dart Sass in mind. We will, hopefully, add Dart Sass support (#97).

With that in mind, if you looks at those docs carefully, it says that $whiteness and $blackness is only supported in Dart Sass

Screenshot 2023-01-12 at 3 30 37 PM

You can still use adjust-color color though, just not those arguments:

> sass::sass("foo { color: adjust-color(red, $hue: -6deg); }")
/* CSS */
foo {
  color: #ff001a;
}

Closing since this essentially a duplicate of #97

@yogat3ch
Copy link
Author

Oh boy, I somehow overlooked the Xs thinking they were a close tab icon 😅 Pattern recognition gone wrong. I was hoping to adjust the lightness, and ended up just doing it in R with colorscape::lighten and glueing in via some inline use of sass. Thank you for the response @cpsievert!

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

2 participants