Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johncoene/linne
🌊 Write CSS in R
https://github.com/johncoene/linne
css r rstats
Last synced: 10 days ago
JSON representation
🌊 Write CSS in R
- Host: GitHub
- URL: https://github.com/johncoene/linne
- Owner: JohnCoene
- License: other
- Created: 2020-07-19T15:24:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-15T20:58:47.000Z (almost 3 years ago)
- Last Synced: 2024-05-01T15:29:49.589Z (6 months ago)
- Topics: css, r, rstats
- Language: R
- Homepage: https://linne.john-coene.com
- Size: 1.95 MB
- Stars: 77
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![R-CMD-check](https://github.com/JohnCoene/linne/workflows/R-CMD-check/badge.svg)](https://github.com/JohnCoene/linne/actions)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/JohnCoene/linne?branch=master&svg=true)](https://ci.appveyor.com/project/JohnCoene/linne)
[![Coveralls test coverage](https://coveralls.io/repos/github/JohnCoene/linne/badge.svg)](https://coveralls.io/github/JohnCoene/linne)CSS in R
[Website](https://linne.john-coene.com/) | [Get Started](https://linne.john-coene.com/articles/get-started.html)
## Installation
Install the stable version from CRAN.
``` r
install.packages("linne")
```Or install the development version from Github.
``` r
# install.packages("remotes")
remotes::install_github("JohnCoene/linne")
```## Example
{linne} contains a single reference class which comes with just a few core methods. Always start with the `new` method to instantiate a new class.
```r
library(linne)linne <- Linne$new()
```There are two core methods to {linne}:
- `define` - Define a global variable
- `rule` - Add a CSS ruleLet's say you want to change the look and feel of this button in a shiny application.
```r
actionButton(inputId = "myButton", label = "Click me")
```Using {linne} we define a CSS rule with the `rule` method to change how it looks.
```r
library(linne)linne <- Linne$
new()$
rule(
sel_input("myButton"), # inputId = "myButton"
backgroundColor = 'red',
fontSize = 20,
color = "white"
)
```{linne} will automatically convert integers and numerics to pixels, therefore the above changes the font size to 20 pixels.
```r
library(linne)
library(shiny)ui <- fluidPage(
linne$include(), # include the CSS
actionButton(inputId = "myButton", label = "Click me")
)server <- function(input, output){}
shinyApp(ui, server)
```## Code of Conduct
Please note that the linne project is released with a [Contributor Code of Conduct](https://linne.john-coene.com/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.