leaderboard / src /display /css_html_js.py
ghzhang233's picture
Fix pretrained default filter and mode-aware figure styling
9b54d88
custom_css = """
/* ============================================================
Layout & Typography
============================================================ */
.gradio-container {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
max-width: 100% !important;
}
/* ============================================================
Header — light mode (default)
============================================================ */
#lm-harmony-header {
padding: 36px 8px 28px 8px;
border-bottom: 1px solid #e2e8f0;
margin-bottom: 8px;
}
#lm-harmony-header-content {
max-width: 860px;
}
#space-title {
font-size: 2rem !important;
font-weight: 800 !important;
color: #3730a3 !important;
margin: 0 0 10px 0 !important;
letter-spacing: -0.02em;
line-height: 1.2;
}
#lm-harmony-tagline {
font-size: 1.05rem;
color: #475569;
margin: 0 0 20px 0;
line-height: 1.6;
}
#lm-harmony-tagline strong {
color: #1e1b4b;
}
#lm-harmony-links {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.lm-btn {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 7px 16px;
border-radius: 8px;
font-size: 0.875rem;
font-weight: 600;
text-decoration: none !important;
transition: all 0.15s ease;
color: #4338ca !important;
background: #eef2ff;
border: 1px solid #c7d2fe;
}
.lm-btn:hover {
background: #e0e7ff;
border-color: #a5b4fc;
color: #3730a3 !important;
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}
/* ============================================================
Header — dark mode
============================================================ */
.dark #lm-harmony-header {
border-bottom-color: #2d3748;
}
.dark #space-title {
color: #f1f5f9 !important;
}
.dark #lm-harmony-tagline {
color: #94a3b8;
}
.dark #lm-harmony-tagline strong {
color: #a5b4fc;
}
.dark .lm-btn {
color: #a5b4fc !important;
background: rgba(99, 102, 241, 0.12);
border: 1px solid rgba(99, 102, 241, 0.3);
}
.dark .lm-btn:hover {
background: rgba(99, 102, 241, 0.22);
border-color: rgba(99, 102, 241, 0.55);
color: #c7d2fe !important;
box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}
/* ============================================================
Dark theme — Gradio CSS variable overrides
Scoped to .dark so light mode is unaffected.
============================================================ */
.dark,
.dark .gradio-container {
--body-background-fill: #0f1117 !important;
--background-fill-primary: #0f1117 !important;
--background-fill-secondary: #161b27 !important;
--block-background-fill: #161b27 !important;
--input-background-fill: #1e2638 !important;
--panel-background-fill: #161b27 !important;
--table-even-background-fill: #161b27 !important;
--table-odd-background-fill: #1a2032 !important;
--block-border-color: #2d3748 !important;
--input-border-color: #2d3748 !important;
--border-color-primary: #2d3748 !important;
--body-text-color: #e2e8f0 !important;
--body-text-color-subdued: #94a3b8 !important;
--label-text-color: #94a3b8 !important;
--block-title-text-color: #e2e8f0 !important;
--block-label-text-color: #94a3b8 !important;
--color-accent: #6366f1 !important;
--link-text-color: #818cf8 !important;
--link-text-color-hover: #a5b4fc !important;
--button-primary-background-fill: #6366f1 !important;
--button-primary-background-fill-hover: #4f46e5 !important;
--button-primary-text-color: #ffffff !important;
--button-secondary-background-fill: #1e2638 !important;
--button-secondary-text-color: #e2e8f0 !important;
--button-secondary-border-color: #2d3748 !important;
--checkbox-background-color: #1e2638 !important;
--slider-color: #6366f1 !important;
--shadow-drop: rgba(0,0,0,0.5) !important;
}
.dark body {
background-color: #0f1117 !important;
}
.dark .gradio-container {
background-color: #0f1117 !important;
color: #e2e8f0 !important;
}
.dark .block,
.dark .form,
.dark fieldset {
background-color: #161b27 !important;
border-color: #2d3748 !important;
}
.dark input,
.dark textarea,
.dark select {
background-color: #1e2638 !important;
color: #e2e8f0 !important;
border-color: #2d3748 !important;
}
.dark .tabitem {
background-color: #0f1117 !important;
}
/* ============================================================
Markdown text — light
============================================================ */
.markdown-text {
font-size: 16px !important;
line-height: 1.75 !important;
}
#models-to-add-text {
font-size: 18px !important;
}
/* Figures in the About page — light mode: show as-is */
.markdown-text img {
border-radius: 8px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
/* Markdown tables */
.markdown-text table th {
background-color: #f1f5f9;
}
.markdown-text table tr:nth-child(even) {
background-color: #f8fafc;
}
/* ============================================================
Markdown text — dark
============================================================ */
.dark .markdown-text {
color: #cbd5e1 !important;
}
.dark .markdown-text h1,
.dark .markdown-text h2,
.dark .markdown-text h3,
.dark .markdown-text h4 {
color: #f1f5f9 !important;
}
.dark .markdown-text a {
color: #818cf8 !important;
}
.dark .markdown-text strong {
color: #e2e8f0 !important;
}
.dark .markdown-text code {
background: #1e2638 !important;
color: #a5b4fc !important;
padding: 2px 6px;
border-radius: 4px;
}
/* Dark mode: invert + hue-rotate makes white-bg matplotlib plots look native dark.
!important overrides the inline style (which has no filter) on the <img> tags. */
.dark .markdown-text img {
filter: invert(1) hue-rotate(180deg) !important;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.dark .markdown-text table th {
background-color: #1e2638 !important;
color: #e2e8f0 !important;
border: 1px solid #2d3748 !important;
}
.dark .markdown-text table td {
border: 1px solid #2d3748 !important;
color: #cbd5e1 !important;
}
.dark .markdown-text table tr:nth-child(even) {
background-color: #161b27 !important;
}
.dark .markdown-text table tr:nth-child(odd) {
background-color: #1a2032 !important;
}
/* ============================================================
Tabs — light
============================================================ */
.tab-buttons {
margin-top: 4px;
border-bottom: 1px solid #e2e8f0;
}
.tab-buttons button {
font-size: 15px !important;
font-weight: 600 !important;
color: #64748b !important;
border: none !important;
border-bottom: 2px solid transparent !important;
border-radius: 0 !important;
background: transparent !important;
padding: 10px 18px !important;
transition: color 0.15s ease, border-color 0.15s ease !important;
}
.tab-buttons button.selected {
color: #4338ca !important;
border-bottom: 2px solid #4338ca !important;
background: transparent !important;
box-shadow: none !important;
}
.tab-buttons button:hover:not(.selected) {
color: #334155 !important;
background: #f1f5f9 !important;
}
/* ============================================================
Tabs — dark
============================================================ */
.dark .tab-buttons {
border-bottom-color: #2d3748;
}
.dark .tab-buttons button {
color: #64748b !important;
}
.dark .tab-buttons button.selected {
color: #818cf8 !important;
border-bottom: 2px solid #6366f1 !important;
}
.dark .tab-buttons button:hover:not(.selected) {
color: #94a3b8 !important;
background: rgba(99, 102, 241, 0.06) !important;
}
/* ============================================================
Leaderboard table
============================================================ */
#leaderboard-table {
margin-top: 16px;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 0 0 1px #e2e8f0;
}
.dark #leaderboard-table {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 0 1px #2d3748;
}
#leaderboard-table-lite {
margin-top: 15px;
}
/* Limit model name column width */
#leaderboard-table td:nth-child(2),
#leaderboard-table th:nth-child(2) {
max-width: 400px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ============================================================
Search bar
============================================================ */
#search-bar-table-box > div:first-child {
background: none;
border: none;
}
#search-bar {
padding: 0px;
}
/* ============================================================
Filters
============================================================ */
#filter_type {
border: 0;
padding-left: 0;
padding-top: 0;
}
#filter_type label {
display: flex;
}
#filter_type label > span {
margin-top: var(--spacing-lg);
margin-right: 0.5em;
}
#filter_type label > .wrap {
width: 103px;
}
#filter_type label > .wrap .wrap-inner {
padding: 2px;
}
#filter_type label > .wrap .wrap-inner input {
width: 1px;
}
#filter-columns-type {
border: 0;
padding: 0.5;
}
#filter-columns-size {
border: 0;
padding: 0.5;
}
#box-filter > .form {
border: 0;
}
/* ============================================================
Citation — light
============================================================ */
#citation-button span {
font-size: 14px !important;
}
#citation-button textarea {
font-size: 13px !important;
border-radius: 8px !important;
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace !important;
}
#citation-button > label > button {
margin: 6px;
transform: scale(1.3);
}
/* ============================================================
Citation — dark
============================================================ */
.dark #citation-button textarea {
background: #1e2638 !important;
border-color: #2d3748 !important;
color: #cbd5e1 !important;
}
.dark .accordion {
background-color: #161b27 !important;
border-color: #2d3748 !important;
}
/* ============================================================
Scale logo (template leftover)
============================================================ */
#scale-logo {
border-style: none !important;
box-shadow: none;
display: block;
margin-left: auto;
margin-right: auto;
max-width: 600px;
}
#scale-logo .download {
display: none;
}
"""
get_window_url_params = """
function(url_params) {
const params = new URLSearchParams(window.location.search);
url_params = Object.fromEntries(params);
return url_params;
}
"""