ori
November 29, 2021, 8:56pm
1
Hi community,
How do I change the font size or color of the columns header in st.dataframe ?
Right now the color is too bright. Any workaround?
example:
Blockquote
import pandas as pd
import streamlit as st
data = {
“calories”: [420, 380, 390],
“duration”: [50, 40, 45]
}
df = pd.DataFrame(data)
st.dataframe(df)
Thanks in advance.
1 Like
Igor
November 30, 2021, 8:54am
2
@ori
a bit of css for these divs works just fine:
div[class="ReactVirtualized__Grid table-bottom-left"] div,
div[class="ReactVirtualized__Grid table-top-right"] div {
color: red;
}
ori
December 4, 2021, 5:17pm
3
Thanks Igor,
but how do you actually implement that in code?
Why doesn’t the Streamlit API offer a solution for this because the color is rather annoying?
Thanks :))
Igor
December 25, 2021, 7:22am
4
@ori
I do something like this:
create file called style.css in my project folder
put mentioned css code in it
and last thing, in my python file straight after calling st.set_page_config() add following code in order to apply css to my app :
import os
curdir = os.path.dirname(os.path.realpath(__file__)) + r'\\'
css_file = os.path.join(curdir, 'style.css')
def local_css(css_file):
with open(css_file) as f:
st.markdown('<style>{}</style>'.format(f.read()), unsafe_allow_html=True)
local_css(css_file)
Why doesn’t the Streamlit API offer a solution for this because the color is rather annoying?
I believe they have been focused more on performance staff lately)
system
Closed
December 25, 2022, 7:23am
5
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.