2022/12/14 にリリースされた Streamlit の Version 1.16.0 から st.markdown や st.header でフォントの色指定が可能になったそうです。
Colored text, using the syntax :color[text to be colored], where color needs to be replaced with any of the following supported colors: blue, green, orange, red, violet.
指定可能な色は現状、以下の 5 種類のみのようです。
- blue
- green
- orange
- red
- violet.
サンプルコード
以下のサンプルコードを用意します。
import streamlit as st
st.markdown(":blue[Text1]")
st.markdown("*:green[Text2]*")
st.markdown("**:orange[Text3]**")
st.markdown("~~:red[Text4]~~")
st.markdown(":violet[Text5]")
実行結果
サンプルコードを実行してみます。
streamlit run sample.py
http://ADDRESS:8501/
へアクセスすると以下のように表示されました。
コメント