📘 Introduction

Streamlit makes it easy to turn Python scripts into interactive web apps — no front-end coding needed. But what if you want to adjust the look and feel? Maybe you want a dark theme, different fonts, or brand colors.

The good news: Streamlit has a built-in theme system that lets you style your app with just a small configuration file. In this tutorial, you’ll learn how to build a basic app, run it, and then give it a custom theme.

✅ Prerequisites

Before starting, make sure you have the following:

🐍☑️ Python installed
📦☑️ Pip installed
🌐☑️ A virtual environment (venv) created and activated

📦1️⃣ Install Libraries

Install the following Python packages using pip:

pip install streamlit pandas numpy

📥2️⃣ Import Libraries

Start by importing the required Python modules:

import streamlit as st
import pandas as pd
import numpy as np

✍️3️⃣ Create a Basic App

First, let’s create a simple app and run it.

Create a file called app.py and add the following code:

import streamlit as st
import pandas as pd
import numpy as np

st.title("Themed Streamlit App 🎨")
st.write("This app demonstrates how to use Streamlit themes.")

# Add a slider
points = st.slider("Select number of points", 10, 100)

# Generate random data
data = pd.DataFrame({
    'x': np.arange(points),
    'y': np.random.randn(points).cumsum()
})

# Show a line chart
st.line_chart(data.set_index('x'))

Now run your app from the terminal:

streamlit run app.py

💻4️⃣ Set Up a Theme

To change the look of your app, Streamlit uses a config file.

You can view this post with the tier: Academy Membership

Join academy now to read the post and get access to the full library of premium posts for academy members only.

Join Academy Already have an account? Sign In