Replies: 7 comments
-
Could you put together a minimal example of what code you need to do this now, and what code you'd need after your proposed change? |
Beta Was this translation helpful? Give feedback.
-
BTW, here's a hack to let you do it with the current
This isn't a good solution, but will let you put together your examples more easily. |
Beta Was this translation helpful? Give feedback.
-
Than you for your input. I added the cell_spec_html() function to my code and added the parameter:
just before line 129, and changed line 129 to 140 to
I have a number of values in cells where I want the background of some of the cells (all of the cell) to be conditionally colored, example:
Later in the code:
Without classes I need (!?!?) to do something like:
Furthermore, I must set the colors to the exact colors I want in 1. above, and if I want to change the colors I must rerun many parts of the script. |
Beta Was this translation helpful? Give feedback.
-
Thanks, that's very helpful. I've just put together a PR based on your suggestion. I used "class" instead of "html_class" as the name, and modified your code a bit. Could you take a look? It is #872 . You can install it if you install from the "classed_cell_spec" branch. |
Beta Was this translation helpful? Give feedback.
-
I've merged the PR. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I haven't tested it until know. There is possibly one small detail left. Then I added an argument to specify a css-file. The file is included with htmltools::includeCSS. It works, but it is not very flexible.
And to call the function with a stylesheet:
|
Beta Was this translation helpful? Give feedback.
-
Hmm... When I think about it, it is not harder to add the html outside the print function, so there is really no reason to change it. |
Beta Was this translation helpful? Give feedback.
-
The cell_spec function has an "extra_css" argument to specify styles for the element. It would be nice if there was a class argument to set the css class of the added span element for cleaner code.
Also, setting the background argument adds for example "border-radius: 4px" as a style. This looks nice, but is not always desirable and having the possibility to add a css class would make the code cleaner.
Beta Was this translation helpful? Give feedback.
All reactions