Comments (3)
What do you want to happen instead? You want black text?
from formattable.
Visible text should suffice.
from formattable.
I think you maybe have another setting, like a default to white text?
When I use your code , I get black text knitted.
However, when I have an issue with color, possibly that needs to be changing with the background, I write a custom function.
Here's an example, stoplight tile...which turns text white with a red background but otherwise has black text.
stoplighttile <- function(cut1 = .1, cut2 = .2, fun = "comma", digits = 0) {
fun <- match.fun(fun)
formatter("span", x ~ fun(x, digits = digits),
style = function(y) style(
display = "block",
padding = "0 4px",
"border-radius" = "4px",
"color" = ifelse( y >= cut2, csscolor("#FFFDF9"), csscolor("black")),
"background-color" = ifelse( y < cut1, csscolor("#50D890"),
ifelse( y < cut2, csscolor("#F6DA63"),
csscolor("#E32249")))
)
)
}
with your data,
formattable(products, list(
price = color_tile("transparent", "lightpink"),
rating = color_bar("lightgreen"),
market_share = stoplighttile(cut1 = 0.05, cut2 = 0.1, fun = "percent", digits = 0)
)
)
NOTE: I used the tile function on the market share column and not on the price column where you were having the issue, but I hope it makes sense.
from formattable.
Related Issues (20)
- Embed hyperlink into Glyphicon HOT 3
- Support fontawesome HOT 1
- Feature Request: easy creation of image columns HOT 2
- Make formattable work with promises-package HOT 3
- Warning: Error in writeImpl: Text to be written must be a length-one character vector HOT 5
- Extract vector classes to a separate package?
- latex output
- Retire Travis and AppVeyor HOT 9
- Change header text by icontext
- Update NEWS and create tag HOT 2
- Feature Request - Implement vctrs methods to support tidyr
- digit number HOT 2
- Is there a way to save formattable to pure html, not through htmlwidgets?
- Does formattable has similar function as `merge_v` in `flextable`?
- Formattable + DT Sorting Issue with multi colour bars.
- No formatted table produced HOT 4
- Use of hex codes within style() HOT 1
- conflict with patchwork HOT 2
- replace glyphicons with FontAwesome ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formattable.