[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KGH2N2BM67Y1RGWXY3ZNNT":3,"skill-same:01M6KGH2N2BM67Y1RGWXY3ZNNT":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":41,"commitSha":42,"skillDirectory":43,"forksCount":44,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":47,"install":48,"resources":61},"01M6KGH2N2BM67Y1RGWXY3ZNNT","creating-streamlit-themes",null,"Creating and customizing Streamlit themes. Use when changing app colors, fonts, or appearance, or aligning apps to brand guidelines. Covers config.toml configuration, design principles, and CSS avoidance.","legout\u002Fpi-config","legout","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1469563?v=4","01M6KGERP7E8TF4XARRKPFJ6HQ","Volker L.","01M6KGERT1FYD049PP1WW923TZ",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fcreating-streamlit-themes\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"creating streamlit themes","themes","streamlit","configuration","fonts","principles","apps","app","toml","design","design principles","use","brand","guidelines","config","css","brand guidelines","2026-11-10 10:12:30",false,"---\nname: creating-streamlit-themes\ndescription: Creating and customizing Streamlit themes. Use when changing app colors, fonts, or appearance, or aligning apps to brand guidelines. Covers config.toml configuration, design principles, and CSS avoidance.\nlicense: Apache-2.0\n---\n\n# Creating Streamlit themes\n\nBuild professional, brand-aligned themes using `.streamlit\u002Fconfig.toml`. This skill covers design principles and complete configuration for polished, cohesive themes.\n\n## Theme file setup\n\nTheme options go in Streamlit's `config.toml` under the `[theme]` section:\n\n## Theme inheritance\n\nStart from a built-in theme or external file:\n\n```toml\n[theme]\nbase = \"light\"                         # or \"dark\"\n# base = \".\u002Fmy-base-theme.toml\"        # Local file\n# base = \"https:\u002F\u002Fexample.com\u002Ftheme.toml\"  # Remote URL\n```\n\nWhen using `base`, you only need to override the values you want to change. Theme files referenced via `base` can only contain a single `[theme]` section—`[theme.light]` and `[theme.dark]` variants are not supported in external theme files.\n\n## Color configuration\n\n### Theme colors\n\n```toml\n[theme]\nprimaryColor = \"#0969da\"           # Buttons, links, active elements\nbackgroundColor = \"#ffffff\"        # Main content background\nsecondaryBackgroundColor = \"#f6f8fa\"  # Widget backgrounds, code blocks\ntextColor = \"#1F2328\"              # Body text\n\n# Optional refinements\nlinkColor = \"#0969da\"              # Markdown links (defaults to primaryColor)\ncodeTextColor = \"#1F2328\"          # Inline code text\ncodeBackgroundColor = \"#f6f8fa\"    # Code block background\nborderColor = \"#d0d7de\"            # Widget borders\n```\n\n**Design principle:** Choose a `primaryColor` dark enough to contrast with white text. Streamlit renders the text of primary buttons white against the primary color.\n\n### Color palette\n\nDefine semantic colors for status indicators, markdown text coloring, and sparklines:\n\n```toml\n[theme]\nredColor = \"#cf222e\"\norangeColor = \"#bf8700\"\nyellowColor = \"#dbab09\"\ngreenColor = \"#1a7f37\"\nblueColor = \"#0969da\"\nvioletColor = \"#8250df\"\ngrayColor = \"#57606a\"\n```\n\nEach color supports background and text variants (auto-derived if not set):\n\n```toml\n[theme]\ngreenColor = \"#1a7f37\"\ngreenBackgroundColor = \"#dafbe1\"   # Light tint for badges\ngreenTextColor = \"#116329\"         # Darkened for readability\n```\n\n### Chart colors\n\nDefine colors for Plotly, Altair, and Vega-Lite charts:\n\n```toml\n[theme]\n# Categorical data (bars, pie slices, series)\nchartCategoricalColors = [\"#0969da\", \"#1a7f37\", \"#bf3989\", \"#8250df\", \"#cf222e\", \"#bf8700\", \"#57606a\"]\n\n# Sequential\u002Fgradient data (heatmaps) - exactly 10 colors required\nchartSequentialColors = [\"#f0f6fc\", \"#c8e1ff\", \"#79c0ff\", \"#58a6ff\", \"#388bfd\", \"#1f6feb\", \"#1158c7\", \"#0d419d\", \"#0a3069\", \"#04244a\"]\n```\n\n### Dataframe styling\n\n```toml\n[theme]\ndataframeBorderColor = \"#d0d7de\"\ndataframeHeaderBackgroundColor = \"#f6f8fa\"\n```\n\nEnsure `textColor` is readable against `dataframeHeaderBackgroundColor`—headers use the main text color.\n\n## Typography\n\n### Font families\n\nUse built-in fonts, load from Google Fonts, or define custom fonts from font files (see below):\n\n```toml\n[theme]\n# Built-in options\nfont = \"sans-serif\"  # or \"serif\" or \"monospace\"\n\n# Google Fonts\nfont = \"Inter:https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Inter:wght@300;400;500;600;700&display=swap\"\n\n# Font with spaces in name\nfont = \"'IBM Plex Sans':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=IBM+Plex+Sans:wght@400;500;600&display=swap\"\n```\n\n### Self-hosting custom fonts\n\nUse `[[theme.fontFaces]]` tables to load fonts via Streamlit's static file serving. Font files must be placed in a `static\u002F` directory and served through the app—they cannot be arbitrary local file paths.\n\n**Before adding fonts to config.toml:** Verify the font files exist in the static directory.\n\n```toml\n[[theme.fontFaces]]\nfamily = \"CustomFont\"\nurl = \"app\u002Fstatic\u002FCustomFont-Regular.woff2\"\nweight = 400\n\n[[theme.fontFaces]]\nfamily = \"CustomFont\"\nurl = \"app\u002Fstatic\u002FCustomFont-Bold.woff2\"\nweight = 700\n\n[theme]\nfont = \"CustomFont\"\n```\n\n**Attributes:** `family` (name), `url` (path to OTF\u002FTTF\u002FWOFF\u002FWOFF2), `weight` (400, \"200 800\", or \"bold\"), `style` (\"normal\"\u002F\"italic\"\u002F\"oblique\"), `unicodeRange` (e.g., \"U+0000-00FF\").\n\nChanges to `fontFaces` require a server restart.\n\n### Heading and code fonts\n\n```toml\n[theme]\nheadingFont = \"Inter:https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Inter:wght@600;700&display=swap\"\ncodeFont = \"'JetBrains Mono':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=JetBrains+Mono:wght@400;500&display=swap\"\n```\n\n### Font sizing and weight\n\n```toml\n[theme]\nbaseFontSize = 14                  # Root size in pixels (default: 16)\nbaseFontWeight = 400               # Normal weight\ncodeFontSize = \"0.875rem\"          # Relative to base, or use \"13px\"\ncodeFontWeight = 400\n\n# Heading hierarchy (h1 through h6), or use a single value for all\nheadingFontSizes = [\"32px\", \"24px\", \"20px\", \"16px\", \"14px\", \"12px\"]\nheadingFontWeights = [600, 600, 600, 500, 500, 500]\n```\n\n### Link styling\n\n```toml\n[theme]\nlinkUnderline = false              # Remove underlines for cleaner look\n```\n\n## Border and radius\n\n```toml\n[theme]\nbaseRadius = \"8px\"                 # All components (none\u002Fsmall\u002Fmedium\u002Flarge\u002Ffull\u002Fpx\u002Frem)\nbuttonRadius = \"8px\"               # Buttons specifically (defaults to baseRadius)\nshowWidgetBorder = true            # Show borders on unfocused widgets\nshowSidebarBorder = true           # Show divider between sidebar and content\n```\n\n**Radius keywords:** `\"none\"` (0), `\"small\"` (4px), `\"medium\"` (8px), `\"large\"` (12px), `\"full\"` (pill shape).\n\n## Sidebar customization\n\nStyle the sidebar independently:\n\n```toml\n[theme.sidebar]\nbackgroundColor = \"#f6f8fa\"\nsecondaryBackgroundColor = \"#eaeef2\"\ncodeBackgroundColor = \"#eaeef2\"\ntextColor = \"#1F2328\"\nborderColor = \"#d0d7de\"\nprimaryColor = \"#0969da\"           # Active elements in sidebar\n```\n\n## Light and dark modes\n\nDefine separate themes for each mode:\n\n```toml\n[theme.light]\nprimaryColor = \"#0969da\"\nbackgroundColor = \"#ffffff\"\nsecondaryBackgroundColor = \"#f6f8fa\"\ntextColor = \"#1F2328\"\n\n[theme.dark]\nprimaryColor = \"#58a6ff\"\nbackgroundColor = \"#0d1117\"\nsecondaryBackgroundColor = \"#161b22\"\ntextColor = \"#e6edf3\"\n\n[theme.light.sidebar]\nbackgroundColor = \"#f6f8fa\"\n\n[theme.dark.sidebar]\nbackgroundColor = \"#010409\"\n```\n\nUsers can switch between modes in the app settings menu only if both `[theme.light]` and `[theme.dark]` are defined. A custom theme with just `[theme]` locks the app to a single mode.\n\n## Detecting current theme\n\nUse `st.context.theme.base` to adapt your app to the active theme. Useful for:\n\n- Adjusting specific chart colors for better contrast\n- Swapping logos or images (e.g., dark logo on light, light logo on dark)\n- Styling third-party components that don't auto-adapt\n- Applying conditional CSS or custom styling\n\n```python\nif st.context.theme.base == \"dark\":\n    # Do something for dark mode\n```\n\n## Design principles\n\n### Color contrast\n\nEnsure WCAG AA compliance (4.5:1 ratio for text):\n- Light themes: Dark text (#1F2328) on light backgrounds (#ffffff)\n- Dark themes: Light text (#e6edf3) on dark backgrounds (#0d1117)\n- Primary colors must contrast with white button text\n\n### Color harmony\n\nBuild cohesive palettes using these approaches:\n\n**Monochromatic:** Single hue with varying lightness (e.g., shadcn's zinc grays)\n```toml\nprimaryColor = \"#18181B\"\ntextColor = \"#09090B\"\nborderColor = \"#E4E4E7\"\ngrayColor = \"#71717A\"\n```\n\n**Brand accent:** Neutral base with one brand color (e.g., Stripe's purple)\n```toml\nprimaryColor = \"#635bff\"           # Brand purple\nbackgroundColor = \"#ffffff\"\ntextColor = \"#425466\"              # Neutral gray\n```\n\n**Complementary:** Brand primary with supporting accent colors\n```toml\nprimaryColor = \"#29B5E8\"           # Brand blue (Snowflake)\ntextColor = \"#11567F\"              # Darker blue for text\ngreenColor = \"#36B37E\"             # Success states\nredColor = \"#DE350B\"               # Error states\n```\n\n### Typography guidelines\n\n- **Body text:** 14-16px, weight 400\n- **Headings:** Decreasing scale from h1 (28-40px) to h6 (12-14px)\n- **Code:** Monospace font, slightly smaller than body (0.85-0.875rem)\n- **Font pairing:** Use the same font for body and headings for consistency, or pair complementary fonts (e.g., serif headings with sans-serif body). Code should always use a distinct monospace font.\n\n### Visual hierarchy\n\nCreate depth with background layers:\n```\nMain content:        #ffffff (lightest)\nSecondary elements:  #f6f8fa (slightly darker)\nSidebar:             #f6f8fa or contrasting brand color\nCode blocks:         #f6f8fa (matches secondary or distinct)\n```\n\n## Example: Snowflake brand theme\n\nClean, professional theme with brand blue accents:\n\n```toml\n[theme]\nprimaryColor = \"#29B5E8\"\nbackgroundColor = \"#ffffff\"\nsecondaryBackgroundColor = \"#f4f9fc\"\ncodeBackgroundColor = \"#e8f4f8\"\ntextColor = \"#11567F\"\nlinkColor = \"#29B5E8\"\nborderColor = \"#d0e8f2\"\nshowWidgetBorder = true\nshowSidebarBorder = true\nbaseRadius = \"8px\"\nbuttonRadius = \"8px\"\n\nfont = \"'Inter':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Inter:wght@300;400;500;600;700&display=swap\"\ncodeFont = \"'JetBrains Mono':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=JetBrains+Mono:wght@400;500&display=swap\"\ncodeFontSize = \"13px\"\ncodeTextColor = \"#11567F\"\nbaseFontSize = 14\nbaseFontWeight = 400\nheadingFontSizes = [\"32px\", \"24px\", \"20px\", \"16px\", \"14px\", \"12px\"]\nheadingFontWeights = [600, 600, 600, 500, 500, 500]\nlinkUnderline = false\n\nchartCategoricalColors = [\"#29B5E8\", \"#11567F\", \"#71C8E5\", \"#174D6A\", \"#A5DDF2\", \"#0E4D6B\", \"#52B8D9\"]\n\nblueColor = \"#29B5E8\"\ngreenColor = \"#36B37E\"\nyellowColor = \"#FFAB00\"\nredColor = \"#DE350B\"\nvioletColor = \"#6554C0\"\n\ndataframeBorderColor = \"#d0e8f2\"\ndataframeHeaderBackgroundColor = \"#e8f4f8\"\n\n[theme.sidebar]\nbackgroundColor = \"#11567F\"\nsecondaryBackgroundColor = \"#174D6A\"\ncodeBackgroundColor = \"#0E4D6B\"\ntextColor = \"#ffffff\"\nborderColor = \"#1E6D94\"\n```\n\n## Example: VS Code dark theme\n\nDeveloper-focused dark theme with syntax-inspired colors:\n\n```toml\n[theme]\nbase = \"dark\"\nprimaryColor = \"#0078d4\"\nbackgroundColor = \"#1e1e1e\"\nsecondaryBackgroundColor = \"#252526\"\ncodeBackgroundColor = \"#1e1e1e\"\ntextColor = \"#cccccc\"\nlinkColor = \"#3794ff\"\nborderColor = \"#3c3c3c\"\nshowWidgetBorder = true\nshowSidebarBorder = true\nbaseRadius = \"4px\"\nbuttonRadius = \"4px\"\n\nfont = \"'Segoe UI', 'Open Sans':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Open+Sans:wght@300;400;500;600;700&display=swap\"\ncodeFont = \"'Fira Code':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Fira+Code:wght@400;500&display=swap\"\ncodeFontSize = \"13px\"\ncodeTextColor = \"#d4d4d4\"\nbaseFontSize = 14\nbaseFontWeight = 400\nheadingFontSizes = [\"28px\", \"22px\", \"18px\", \"16px\", \"14px\", \"12px\"]\nheadingFontWeights = [600, 600, 600, 600, 600, 600]\nlinkUnderline = false\n\nchartCategoricalColors = [\"#0078d4\", \"#4ec9b0\", \"#dcdcaa\", \"#ce9178\", \"#c586c0\", \"#569cd6\", \"#6a9955\"]\n\nblueColor = \"#569cd6\"\ngreenColor = \"#6a9955\"\nyellowColor = \"#dcdcaa\"\norangeColor = \"#ce9178\"\nvioletColor = \"#c586c0\"\n\n[theme.sidebar]\nbackgroundColor = \"#252526\"\nsecondaryBackgroundColor = \"#333333\"\ncodeBackgroundColor = \"#1e1e1e\"\nborderColor = \"#3c3c3c\"\n```\n\n## Common mistakes\n\n### Primary color too light\n\n```toml\n# BAD: White text on yellow is unreadable\nprimaryColor = \"#FFEB3B\"\n\n# GOOD: Use a darker shade\nprimaryColor = \"#F59E0B\"\n```\n\n### Insufficient contrast\n\n```toml\n# BAD: Light gray text on white\ntextColor = \"#CCCCCC\"\nbackgroundColor = \"#FFFFFF\"\n\n# GOOD: Dark text on light background\ntextColor = \"#1F2328\"\nbackgroundColor = \"#FFFFFF\"\n```\n\n### Mismatched backgrounds\n\n```toml\n# BAD: Secondary lighter than primary\nbackgroundColor = \"#f6f8fa\"\nsecondaryBackgroundColor = \"#ffffff\"\n\n# GOOD: Secondary should be darker\u002Fdistinct\nbackgroundColor = \"#ffffff\"\nsecondaryBackgroundColor = \"#f6f8fa\"\n```\n\n### Forgetting sidebar contrast\n\nWhen using a dark sidebar with a light main section, adjust all sidebar colors—not just `textColor`:\n\n```toml\n# BAD: Only changed backgroundColor\n[theme.sidebar]\nbackgroundColor = \"#11567F\"\n\n# GOOD: Adjust all colors for dark sidebar\n[theme.sidebar]\nbackgroundColor = \"#11567F\"\nsecondaryBackgroundColor = \"#174D6A\"\ntextColor = \"#ffffff\"\nborderColor = \"#1E6D94\"\n...\n```\n\n## IMPORTANT: No custom CSS unless explicitly requested\n\n**DO NOT use custom CSS or HTML for theming.** This includes:\n- `st.markdown(..., unsafe_allow_html=True)` with `\u003Cstyle>` or inline styles\n- `st.html()` with `\u003Cstyle>` blocks\n- Any HTML\u002FCSS for colors, backgrounds, fonts, or visual styling\n\n**Only use CSS if the user explicitly asks for it** (e.g., \"add custom CSS\", \"use st.html for styling\"). For brand colors, theming, and visual identity—always use `config.toml`.\n\nNative theming is cleaner, more maintainable, and won't break with Streamlit updates.\n\nIf the user explicitly asks for CSS, use `key=` to create targetable classes:\n\n```python\nst.button(\"Submit\", key=\"submit\")\n# Generates: .st-key-submit\n\nst.html(\"\"\"\u003Cstyle>.st-key-submit button { width: 100%; }\u003C\u002Fstyle>\"\"\")\n```\n\n**Never use CSS for theming (colors, backgrounds, fonts) unless explicitly asked. Use config.toml instead.**\n\n## Development workflow\n\nMost theme options update live after saving `config.toml` and rerunning. Font-related options (`fontFaces`) require a server restart.\n\nTest your theme with: buttons (primary contrast), forms (borders, focus), dataframes (headers), code blocks, charts, and sidebar.\n\n## Theme templates\n\nReady-to-use themes with bundled fonts are available in `templates\u002Fthemes\u002F`:\n\n| Theme | Base | Primary Color | Fonts |\n|-------|------|---------------|-------|\n| **snowflake** | Light | `#29B5E8` (cyan) | Inter, JetBrains Mono |\n| **dracula** | Dark | `#BD93F9` (purple) | Fira Sans, JetBrains Mono |\n| **nord** | Dark | `#88C0D0` (frost blue) | Inter, JetBrains Mono |\n| **stripe** | Light | `#635BFF` (indigo) | Inter, Source Code Pro |\n| **solarized-light** | Light | `#268BD2` (blue) | Source Sans 3, Source Code Pro |\n| **spotify** | Dark | `#1DB954` (green) | Inter, Fira Code |\n| **github** | Light | `#0969DA` (blue) | Inter, JetBrains Mono |\n| **minimal** | Dark | `#6366f1` (indigo) | Inter, JetBrains Mono |\n\nEach theme uses Google Fonts for easy setup. See `templates\u002Fthemes\u002FREADME.md`.\n\n## Related skills\n\n- [improving-streamlit-design](..\u002Fimproving-streamlit-design\u002FSKILL.md) - Visual polish with icons, badges, spacing\n\n## References\n\n- [Theming overview](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fconcepts\u002Fconfiguration\u002Ftheming)\n- [Colors and borders](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fconcepts\u002Fconfiguration\u002Ftheming-customize-colors-and-borders)\n- [Fonts](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fconcepts\u002Fconfiguration\u002Ftheming-customize-fonts)\n- [config.toml reference](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconfiguration\u002Fconfig.toml)\n- [st.context](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fcaching-and-state\u002Fst.context)\n","# Creating Streamlit themes\n\nBuild professional, brand-aligned themes using `.streamlit\u002Fconfig.toml`. This skill covers design principles and complete configuration for polished, cohesive themes.\n\n## Theme file setup\n\nTheme options go in Streamlit's `config.toml` under the `[theme]` section:\n\n## Theme inheritance\n\nStart from a built-in theme or external file:\n\n```toml\n[theme]\nbase = \"light\"                         # or \"dark\"\n# base = \".\u002Fmy-base-theme.toml\"        # Local file\n# base = \"https:\u002F\u002Fexample.com\u002Ftheme.toml\"  # Remote URL\n```\n\nWhen using `base`, you only need to override the values you want to change. Theme files referenced via `base` can only contain a single `[theme]` section—`[theme.light]` and `[theme.dark]` variants are not supported in external theme files.\n\n## Color configuration\n\n### Theme colors\n\n```toml\n[theme]\nprimaryColor = \"#0969da\"           # Buttons, links, active elements\nbackgroundColor = \"#ffffff\"        # Main content background\nsecondaryBackgroundColor = \"#f6f8fa\"  # Widget backgrounds, code blocks\ntextColor = \"#1F2328\"              # Body text\n\n# Optional refinements\nlinkColor = \"#0969da\"              # Markdown links (defaults to primaryColor)\ncodeTextColor = \"#1F2328\"          # Inline code text\ncodeBackgroundColor = \"#f6f8fa\"    # Code block background\nborderColor = \"#d0d7de\"            # Widget borders\n```\n\n**Design principle:** Choose a `primaryColor` dark enough to contrast with white text. Streamlit renders the text of primary buttons white against the primary color.\n\n### Color palette\n\nDefine semantic colors for status indicators, markdown text coloring, and sparklines:\n\n```toml\n[theme]\nredColor = \"#cf222e\"\norangeColor = \"#bf8700\"\nyellowColor = \"#dbab09\"\ngreenColor = \"#1a7f37\"\nblueColor = \"#0969da\"\nvioletColor = \"#8250df\"\ngrayColor = \"#57606a\"\n```\n\nEach color supports background and text variants (auto-derived if not set):\n\n```toml\n[theme]\ngreenColor = \"#1a7f37\"\ngreenBackgroundColor = \"#dafbe1\"   # Light tint for badges\ngreenTextColor = \"#116329\"         # Darkened for readability\n```\n\n### Chart colors\n\nDefine colors for Plotly, Altair, and Vega-Lite charts:\n\n```toml\n[theme]\n# Categorical data (bars, pie slices, series)\nchartCategoricalColors = [\"#0969da\", \"#1a7f37\", \"#bf3989\", \"#8250df\", \"#cf222e\", \"#bf8700\", \"#57606a\"]\n\n# Sequential\u002Fgradient data (heatmaps) - exactly 10 colors required\nchartSequentialColors = [\"#f0f6fc\", \"#c8e1ff\", \"#79c0ff\", \"#58a6ff\", \"#388bfd\", \"#1f6feb\", \"#1158c7\", \"#0d419d\", \"#0a3069\", \"#04244a\"]\n```\n\n### Dataframe styling\n\n```toml\n[theme]\ndataframeBorderColor = \"#d0d7de\"\ndataframeHeaderBackgroundColor = \"#f6f8fa\"\n```\n\nEnsure `textColor` is readable against `dataframeHeaderBackgroundColor`—headers use the main text color.\n\n## Typography\n\n### Font families\n\nUse built-in fonts, load from Google Fonts, or define custom fonts from font files (see below):\n\n```toml\n[theme]\n# Built-in options\nfont = \"sans-serif\"  # or \"serif\" or \"monospace\"\n\n# Google Fonts\nfont = \"Inter:https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Inter:wght@300;400;500;600;700&display=swap\"\n\n# Font with spaces in name\nfont = \"'IBM Plex Sans':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=IBM+Plex+Sans:wght@400;500;600&display=swap\"\n```\n\n### Self-hosting custom fonts\n\nUse `[[theme.fontFaces]]` tables to load fonts via Streamlit's static file serving. Font files must be placed in a `static\u002F` directory and served through the app—they cannot be arbitrary local file paths.\n\n**Before adding fonts to config.toml:** Verify the font files exist in the static directory.\n\n```toml\n[[theme.fontFaces]]\nfamily = \"CustomFont\"\nurl = \"app\u002Fstatic\u002FCustomFont-Regular.woff2\"\nweight = 400\n\n[[theme.fontFaces]]\nfamily = \"CustomFont\"\nurl = \"app\u002Fstatic\u002FCustomFont-Bold.woff2\"\nweight = 700\n\n[theme]\nfont = \"CustomFont\"\n```\n\n**Attributes:** `family` (name), `url` (path to OTF\u002FTTF\u002FWOFF\u002FWOFF2), `weight` (400, \"200 800\", or \"bold\"), `style` (\"normal\"\u002F\"italic\"\u002F\"oblique\"), `unicodeRange` (e.g., \"U+0000-00FF\").\n\nChanges to `fontFaces` require a server restart.\n\n### Heading and code fonts\n\n```toml\n[theme]\nheadingFont = \"Inter:https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Inter:wght@600;700&display=swap\"\ncodeFont = \"'JetBrains Mono':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=JetBrains+Mono:wght@400;500&display=swap\"\n```\n\n### Font sizing and weight\n\n```toml\n[theme]\nbaseFontSize = 14                  # Root size in pixels (default: 16)\nbaseFontWeight = 400               # Normal weight\ncodeFontSize = \"0.875rem\"          # Relative to base, or use \"13px\"\ncodeFontWeight = 400\n\n# Heading hierarchy (h1 through h6), or use a single value for all\nheadingFontSizes = [\"32px\", \"24px\", \"20px\", \"16px\", \"14px\", \"12px\"]\nheadingFontWeights = [600, 600, 600, 500, 500, 500]\n```\n\n### Link styling\n\n```toml\n[theme]\nlinkUnderline = false              # Remove underlines for cleaner look\n```\n\n## Border and radius\n\n```toml\n[theme]\nbaseRadius = \"8px\"                 # All components (none\u002Fsmall\u002Fmedium\u002Flarge\u002Ffull\u002Fpx\u002Frem)\nbuttonRadius = \"8px\"               # Buttons specifically (defaults to baseRadius)\nshowWidgetBorder = true            # Show borders on unfocused widgets\nshowSidebarBorder = true           # Show divider between sidebar and content\n```\n\n**Radius keywords:** `\"none\"` (0), `\"small\"` (4px), `\"medium\"` (8px), `\"large\"` (12px), `\"full\"` (pill shape).\n\n## Sidebar customization\n\nStyle the sidebar independently:\n\n```toml\n[theme.sidebar]\nbackgroundColor = \"#f6f8fa\"\nsecondaryBackgroundColor = \"#eaeef2\"\ncodeBackgroundColor = \"#eaeef2\"\ntextColor = \"#1F2328\"\nborderColor = \"#d0d7de\"\nprimaryColor = \"#0969da\"           # Active elements in sidebar\n```\n\n## Light and dark modes\n\nDefine separate themes for each mode:\n\n```toml\n[theme.light]\nprimaryColor = \"#0969da\"\nbackgroundColor = \"#ffffff\"\nsecondaryBackgroundColor = \"#f6f8fa\"\ntextColor = \"#1F2328\"\n\n[theme.dark]\nprimaryColor = \"#58a6ff\"\nbackgroundColor = \"#0d1117\"\nsecondaryBackgroundColor = \"#161b22\"\ntextColor = \"#e6edf3\"\n\n[theme.light.sidebar]\nbackgroundColor = \"#f6f8fa\"\n\n[theme.dark.sidebar]\nbackgroundColor = \"#010409\"\n```\n\nUsers can switch between modes in the app settings menu only if both `[theme.light]` and `[theme.dark]` are defined. A custom theme with just `[theme]` locks the app to a single mode.\n\n## Detecting current theme\n\nUse `st.context.theme.base` to adapt your app to the active theme. Useful for:\n\n- Adjusting specific chart colors for better contrast\n- Swapping logos or images (e.g., dark logo on light, light logo on dark)\n- Styling third-party components that don't auto-adapt\n- Applying conditional CSS or custom styling\n\n```python\nif st.context.theme.base == \"dark\":\n    # Do something for dark mode\n```\n\n## Design principles\n\n### Color contrast\n\nEnsure WCAG AA compliance (4.5:1 ratio for text):\n- Light themes: Dark text (#1F2328) on light backgrounds (#ffffff)\n- Dark themes: Light text (#e6edf3) on dark backgrounds (#0d1117)\n- Primary colors must contrast with white button text\n\n### Color harmony\n\nBuild cohesive palettes using these approaches:\n\n**Monochromatic:** Single hue with varying lightness (e.g., shadcn's zinc grays)\n```toml\nprimaryColor = \"#18181B\"\ntextColor = \"#09090B\"\nborderColor = \"#E4E4E7\"\ngrayColor = \"#71717A\"\n```\n\n**Brand accent:** Neutral base with one brand color (e.g., Stripe's purple)\n```toml\nprimaryColor = \"#635bff\"           # Brand purple\nbackgroundColor = \"#ffffff\"\ntextColor = \"#425466\"              # Neutral gray\n```\n\n**Complementary:** Brand primary with supporting accent colors\n```toml\nprimaryColor = \"#29B5E8\"           # Brand blue (Snowflake)\ntextColor = \"#11567F\"              # Darker blue for text\ngreenColor = \"#36B37E\"             # Success states\nredColor = \"#DE350B\"               # Error states\n```\n\n### Typography guidelines\n\n- **Body text:** 14-16px, weight 400\n- **Headings:** Decreasing scale from h1 (28-40px) to h6 (12-14px)\n- **Code:** Monospace font, slightly smaller than body (0.85-0.875rem)\n- **Font pairing:** Use the same font for body and headings for consistency, or pair complementary fonts (e.g., serif headings with sans-serif body). Code should always use a distinct monospace font.\n\n### Visual hierarchy\n\nCreate depth with background layers:\n```\nMain content:        #ffffff (lightest)\nSecondary elements:  #f6f8fa (slightly darker)\nSidebar:             #f6f8fa or contrasting brand color\nCode blocks:         #f6f8fa (matches secondary or distinct)\n```\n\n## Example: Snowflake brand theme\n\nClean, professional theme with brand blue accents:\n\n```toml\n[theme]\nprimaryColor = \"#29B5E8\"\nbackgroundColor = \"#ffffff\"\nsecondaryBackgroundColor = \"#f4f9fc\"\ncodeBackgroundColor = \"#e8f4f8\"\ntextColor = \"#11567F\"\nlinkColor = \"#29B5E8\"\nborderColor = \"#d0e8f2\"\nshowWidgetBorder = true\nshowSidebarBorder = true\nbaseRadius = \"8px\"\nbuttonRadius = \"8px\"\n\nfont = \"'Inter':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Inter:wght@300;400;500;600;700&display=swap\"\ncodeFont = \"'JetBrains Mono':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=JetBrains+Mono:wght@400;500&display=swap\"\ncodeFontSize = \"13px\"\ncodeTextColor = \"#11567F\"\nbaseFontSize = 14\nbaseFontWeight = 400\nheadingFontSizes = [\"32px\", \"24px\", \"20px\", \"16px\", \"14px\", \"12px\"]\nheadingFontWeights = [600, 600, 600, 500, 500, 500]\nlinkUnderline = false\n\nchartCategoricalColors = [\"#29B5E8\", \"#11567F\", \"#71C8E5\", \"#174D6A\", \"#A5DDF2\", \"#0E4D6B\", \"#52B8D9\"]\n\nblueColor = \"#29B5E8\"\ngreenColor = \"#36B37E\"\nyellowColor = \"#FFAB00\"\nredColor = \"#DE350B\"\nvioletColor = \"#6554C0\"\n\ndataframeBorderColor = \"#d0e8f2\"\ndataframeHeaderBackgroundColor = \"#e8f4f8\"\n\n[theme.sidebar]\nbackgroundColor = \"#11567F\"\nsecondaryBackgroundColor = \"#174D6A\"\ncodeBackgroundColor = \"#0E4D6B\"\ntextColor = \"#ffffff\"\nborderColor = \"#1E6D94\"\n```\n\n## Example: VS Code dark theme\n\nDeveloper-focused dark theme with syntax-inspired colors:\n\n```toml\n[theme]\nbase = \"dark\"\nprimaryColor = \"#0078d4\"\nbackgroundColor = \"#1e1e1e\"\nsecondaryBackgroundColor = \"#252526\"\ncodeBackgroundColor = \"#1e1e1e\"\ntextColor = \"#cccccc\"\nlinkColor = \"#3794ff\"\nborderColor = \"#3c3c3c\"\nshowWidgetBorder = true\nshowSidebarBorder = true\nbaseRadius = \"4px\"\nbuttonRadius = \"4px\"\n\nfont = \"'Segoe UI', 'Open Sans':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Open+Sans:wght@300;400;500;600;700&display=swap\"\ncodeFont = \"'Fira Code':https:\u002F\u002Ffonts.googleapis.com\u002Fcss2?family=Fira+Code:wght@400;500&display=swap\"\ncodeFontSize = \"13px\"\ncodeTextColor = \"#d4d4d4\"\nbaseFontSize = 14\nbaseFontWeight = 400\nheadingFontSizes = [\"28px\", \"22px\", \"18px\", \"16px\", \"14px\", \"12px\"]\nheadingFontWeights = [600, 600, 600, 600, 600, 600]\nlinkUnderline = false\n\nchartCategoricalColors = [\"#0078d4\", \"#4ec9b0\", \"#dcdcaa\", \"#ce9178\", \"#c586c0\", \"#569cd6\", \"#6a9955\"]\n\nblueColor = \"#569cd6\"\ngreenColor = \"#6a9955\"\nyellowColor = \"#dcdcaa\"\norangeColor = \"#ce9178\"\nvioletColor = \"#c586c0\"\n\n[theme.sidebar]\nbackgroundColor = \"#252526\"\nsecondaryBackgroundColor = \"#333333\"\ncodeBackgroundColor = \"#1e1e1e\"\nborderColor = \"#3c3c3c\"\n```\n\n## Common mistakes\n\n### Primary color too light\n\n```toml\n# BAD: White text on yellow is unreadable\nprimaryColor = \"#FFEB3B\"\n\n# GOOD: Use a darker shade\nprimaryColor = \"#F59E0B\"\n```\n\n### Insufficient contrast\n\n```toml\n# BAD: Light gray text on white\ntextColor = \"#CCCCCC\"\nbackgroundColor = \"#FFFFFF\"\n\n# GOOD: Dark text on light background\ntextColor = \"#1F2328\"\nbackgroundColor = \"#FFFFFF\"\n```\n\n### Mismatched backgrounds\n\n```toml\n# BAD: Secondary lighter than primary\nbackgroundColor = \"#f6f8fa\"\nsecondaryBackgroundColor = \"#ffffff\"\n\n# GOOD: Secondary should be darker\u002Fdistinct\nbackgroundColor = \"#ffffff\"\nsecondaryBackgroundColor = \"#f6f8fa\"\n```\n\n### Forgetting sidebar contrast\n\nWhen using a dark sidebar with a light main section, adjust all sidebar colors—not just `textColor`:\n\n```toml\n# BAD: Only changed backgroundColor\n[theme.sidebar]\nbackgroundColor = \"#11567F\"\n\n# GOOD: Adjust all colors for dark sidebar\n[theme.sidebar]\nbackgroundColor = \"#11567F\"\nsecondaryBackgroundColor = \"#174D6A\"\ntextColor = \"#ffffff\"\nborderColor = \"#1E6D94\"\n...\n```\n\n## IMPORTANT: No custom CSS unless explicitly requested\n\n**DO NOT use custom CSS or HTML for theming.** This includes:\n- `st.markdown(..., unsafe_allow_html=True)` with `\u003Cstyle>` or inline styles\n- `st.html()` with `\u003Cstyle>` blocks\n- Any HTML\u002FCSS for colors, backgrounds, fonts, or visual styling\n\n**Only use CSS if the user explicitly asks for it** (e.g., \"add custom CSS\", \"use st.html for styling\"). For brand colors, theming, and visual identity—always use `config.toml`.\n\nNative theming is cleaner, more maintainable, and won't break with Streamlit updates.\n\nIf the user explicitly asks for CSS, use `key=` to create targetable classes:\n\n```python\nst.button(\"Submit\", key=\"submit\")\n# Generates: .st-key-submit\n\nst.html(\"\"\"\u003Cstyle>.st-key-submit button { width: 100%; }\u003C\u002Fstyle>\"\"\")\n```\n\n**Never use CSS for theming (colors, backgrounds, fonts) unless explicitly asked. Use config.toml instead.**\n\n## Development workflow\n\nMost theme options update live after saving `config.toml` and rerunning. Font-related options (`fontFaces`) require a server restart.\n\nTest your theme with: buttons (primary contrast), forms (borders, focus), dataframes (headers), code blocks, charts, and sidebar.\n\n## Theme templates\n\nReady-to-use themes with bundled fonts are available in `templates\u002Fthemes\u002F`:\n\n| Theme | Base | Primary Color | Fonts |\n|-------|------|---------------|-------|\n| **snowflake** | Light | `#29B5E8` (cyan) | Inter, JetBrains Mono |\n| **dracula** | Dark | `#BD93F9` (purple) | Fira Sans, JetBrains Mono |\n| **nord** | Dark | `#88C0D0` (frost blue) | Inter, JetBrains Mono |\n| **stripe** | Light | `#635BFF` (indigo) | Inter, Source Code Pro |\n| **solarized-light** | Light | `#268BD2` (blue) | Source Sans 3, Source Code Pro |\n| **spotify** | Dark | `#1DB954` (green) | Inter, Fira Code |\n| **github** | Light | `#0969DA` (blue) | Inter, JetBrains Mono |\n| **minimal** | Dark | `#6366f1` (indigo) | Inter, JetBrains Mono |\n\nEach theme uses Google Fonts for easy setup. See `templates\u002Fthemes\u002FREADME.md`.\n\n## Related skills\n\n- [improving-streamlit-design](..\u002Fimproving-streamlit-design\u002FSKILL.md) - Visual polish with icons, badges, spacing\n\n## References\n\n- [Theming overview](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fconcepts\u002Fconfiguration\u002Ftheming)\n- [Colors and borders](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fconcepts\u002Fconfiguration\u002Ftheming-customize-colors-and-borders)\n- [Fonts](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fconcepts\u002Fconfiguration\u002Ftheming-customize-fonts)\n- [config.toml reference](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fconfiguration\u002Fconfig.toml)\n- [st.context](https:\u002F\u002Fdocs.streamlit.io\u002Fdevelop\u002Fapi-reference\u002Fcaching-and-state\u002Fst.context)\n",{"name":5,"license":15,"description":7},"main","3efae68c898153694a2f4aad309c7ff9847b5602","installed-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fcreating-streamlit-themes",0,"https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config","https:\u002F\u002Fgithub.com\u002Flegout","2026-04-28 16:32:33",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add legout\u002Fpi-config --skill creating-streamlit-themes",{"tool":54,"command":55},"bunx","bunx skills add legout\u002Fpi-config --skill creating-streamlit-themes",{"tool":57,"command":58},"pnpm","pnpm dlx skills add legout\u002Fpi-config --skill creating-streamlit-themes","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fcreating-streamlit-themes\u002FSKILL.md",true,[],[63,90,112,125,138,159],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":36},"01M6KGW7MYKZ8MWFKN1V8ZJ2EG","visual-explainer","Generate beautiful, self-contained HTML pages that visually explain systems, code changes, plans, and data. Use when the user asks for a diagram, architecture overview, diff review, plan review, project recap, comparison table, or any visual explanation of technical concepts. Also use proactively when you are about to render a complex ASCII table (4+ rows or 3+ columns) — present it as a styled HTML page instead.","MIT","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Fskills\u002Fvisual-explainer\u002FSKILL.md",[],[71,72,73,74,75,76,77,78,79,30,80,81,82,83,84,85,86,87,88,89],"visual explainer","explainer","visual","image","architecture","generate","plan","table","view","files","project","present","as","ascii table","ascii","you","concepts","surf","for",{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":36},"01M6KGTMTJR6RXXC8AF29MQQW5","table-extractor",">","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Ftable-extractor\u002FSKILL.md",[],[78,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111],"table extractor","PDF","MCP","gpt","extraction","office","data","parsing","extract","en","zh","camelot","sonnet","opus","tables",{"skillNo":113,"name":114,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":36},"01M6KGSWF2R22Z63PAY5NT6GRY","smart-ocr","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fsmart-ocr\u002FSKILL.md",[],[118,119,98,99,120,100,101,102,104,121,105,106,107,122,123,109,110,124],"ocr","smart ocr","support","text","multilingual","processing","paddleocr",{"skillNo":126,"name":127,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":36},"01M6KGMKKFNC1PRNX2W3E243DR","html-slides","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fhtml-slides\u002FSKILL.md",[],[131,132,133,134,99,135,100,102,106,107,136,137,109,110],"slides","html","html slides","pptx","web","revealjs","presentation",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":36},"01M6KGJGVM0TWW632Y6VQQV2WN","using-streamlit-session-state","Using st.session_state to manage state across Streamlit reruns. Use when persisting data, handling widget state, implementing callbacks, or debugging state issues. Covers initialization patterns, widget-state association, and common gotchas.","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fusing-streamlit-session-state\u002FSKILL.md",[],[145,146,21,147,148,149,150,103,151,30,152,153,154,155,156,157,158],"state","session","session state","using streamlit session state","debugging","issues","common","manage","patterns","across","widget","Callbacks","implementing","initialization",{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"publishedAt":36},"01M6KGJD12GJB7W0ZG66JK00F6","using-streamlit-markdown","Covers all Markdown features in Streamlit including GitHub-flavored syntax plus Streamlit extensions like colored text, badges, Material icons, and LaTeX. Use when formatting text, labels, tooltips, or any text-rendering element.","https:\u002F\u002Fgithub.com\u002Flegout\u002Fpi-config\u002Fblob\u002Fmain\u002Finstalled-skills\u002Fdeveloping-with-streamlit\u002Fskills\u002Fusing-streamlit-markdown\u002FSKILL.md",[],[166,21,167,168,169,170,121,171,30,172,173,174,175,176,177,178],"markdown","using streamlit markdown","github","icons","LaTeX","syntax","formatting","element","material","rendering","extensions","features","labels"]