File size: 1,234 Bytes
22df377
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
BACKGROUND_COLOR = "white"
COLOR = "black"

import streamlit as st

def set_page_container_style(
    max_width: int = 1100,
    max_width_100_percent: bool = False,
    padding_top: int = 1,
    padding_right: int = 10,
    padding_left: int = 1,
    padding_bottom: int = 10,
    color: str = COLOR,
    background_color: str = BACKGROUND_COLOR,
):
    if max_width_100_percent:
        max_width_str = f"max-width: 100%;"
    else:
        max_width_str = f"max-width: {max_width}px;"
    st.markdown(
        f"""
            <style>
                .reportview-container .css-1lcbmhc .css-1outpf7 {{
                    padding-top: 35px;
                }}
                .reportview-container .main .block-container {{
                    {max_width_str}
                    padding-top: {padding_top}rem;
                    padding-right: {padding_right}rem;
                    padding-left: {padding_left}rem;
                    padding-bottom: {padding_bottom}rem;
                }}
                .reportview-container .main {{
                    color: {color};
                    background-color: {background_color};
                }}
            </style>
            """,
        unsafe_allow_html=True,
    )