Spaces:
Running
Running
Download ui/theme.py from u5ername/markdown2ppt-docker: direct link, hf CLI and curl.
- Browser
- Download file 19.2 kB
-
https://huggingface.co/spaces/u5ername/markdown2ppt-docker/resolve/main/ui/theme.py
- Command line
-
hf download hf://spaces/u5ername/markdown2ppt-docker/ui/theme.py
-
curl -L -o theme.py https://huggingface.co/spaces/u5ername/markdown2ppt-docker/resolve/main/ui/theme.py
19.2 kB
| """Shared Gradio theme and CSS for every page.""" | |
| import gradio as gr | |
| APP_CSS = r""" | |
| :root { | |
| --bg: #f8fafc; | |
| --col: #1e293b; | |
| --muted: #475569; | |
| --paper: #ffffff; | |
| --rule: #e2e8f0; | |
| --action: #2563eb; | |
| --action-dark: #1d4ed8; | |
| --action-soft: #dbeafe; | |
| --success: #166534; | |
| --success-soft: #f0fdf4; | |
| --warn: #92400e; | |
| --warn-soft: #fffbeb; | |
| --danger: #991b1b; | |
| --danger-soft: #fef2f2; | |
| } | |
| body, .gradio-container { | |
| background: var(--bg) !important; | |
| color: var(--col) !important; | |
| } | |
| .gradio-container { | |
| width: 100% !important; | |
| max-width: 1240px !important; | |
| margin: 0 auto !important; | |
| padding: 0 28px 56px !important; | |
| font-family: Aptos, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif !important; | |
| } | |
| .topbar { | |
| display: flex; | |
| min-height: 72px; | |
| align-items: center; | |
| justify-content: space-between; | |
| gap: 20px; | |
| border-bottom: 1px solid var(--rule); | |
| } | |
| .wordmark { display: flex; align-items: center; gap: 11px; color: var(--col); } | |
| .wordmark-mark { | |
| display: grid; width: 28px; height: 28px; place-items: center; | |
| background: var(--col); color: var(--paper); font-weight: 800; | |
| } | |
| .wordmark strong, .hero-copy h1, .section-title h2 { | |
| font-family: "Arial Narrow", "Aptos Display", "Noto Sans TC", "PingFang TC", sans-serif !important; | |
| } | |
| .wordmark strong { font-size: 18px; letter-spacing: -.02em; } | |
| .topbar-actions { display: flex; align-items: center; gap: 18px; } | |
| .topbar-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; } | |
| .topbar-note::before { | |
| content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--action); | |
| } | |
| .topbar-link, .template-link { | |
| color: var(--action-dark) !important; font-size: 12px; font-weight: 750; | |
| text-decoration: none !important; text-underline-offset: 3px; | |
| } | |
| .topbar-link:hover, .template-link:hover { text-decoration: underline !important; } | |
| .hero-grid { | |
| display: grid; grid-template-columns: minmax(0, .88fr) minmax(430px, 1.12fr); | |
| gap: clamp(40px, 7vw, 88px); align-items: center; | |
| padding: clamp(54px, 8vw, 96px) 0; border-bottom: 1px solid var(--rule); | |
| } | |
| .hero-copy h1 { | |
| max-width: 650px; margin: 0 !important; color: var(--col) !important; | |
| font-size: clamp(50px, 6.5vw, 88px) !important; font-weight: 800 !important; | |
| line-height: .95 !important; letter-spacing: -.055em !important; | |
| } | |
| .hero-copy p { | |
| max-width: 560px; margin: 28px 0 0 !important; color: var(--muted) !important; | |
| font-size: 18px !important; line-height: 1.7 !important; | |
| } | |
| .hero-footnote, .template-note { | |
| margin-top: 26px; padding-left: 13px; border-left: 3px solid var(--action); | |
| color: var(--muted); font-size: 12px; line-height: 1.6; | |
| } | |
| .template-note strong { color: var(--col); } | |
| .transform-visual { | |
| position: relative; display: grid; | |
| grid-template-columns: minmax(0, .82fr) 54px minmax(0, 1.18fr); align-items: center; | |
| } | |
| .source-sheet, .slide-canvas, .rename-visual { | |
| position: relative; border: 1px solid var(--rule); background: var(--paper); | |
| } | |
| .source-sheet { z-index: 2; min-height: 306px; transform: rotate(-1.5deg); } | |
| .slide-canvas { z-index: 2; min-height: 340px; border-top: 5px solid var(--action); box-shadow: 16px 18px 0 var(--action-soft); } | |
| .sheet-bar, .slide-bar, .rename-bar { | |
| display: flex; min-height: 38px; align-items: center; justify-content: space-between; | |
| padding: 0 14px; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 11px; | |
| } | |
| .sheet-lines { padding: 23px 20px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.9; } | |
| .sheet-lines p { margin: 0 !important; color: var(--muted) !important; } | |
| .sheet-lines b { color: var(--action); font-weight: 700; } | |
| .sheet-lines .dim { opacity: .58; } | |
| .transform-track { position: relative; z-index: 1; height: 2px; background: var(--action); } | |
| .transform-track::after, .rename-arrow::after { | |
| content: ""; position: absolute; top: 50%; right: -1px; width: 9px; height: 9px; | |
| border-top: 2px solid var(--action); border-right: 2px solid var(--action); | |
| transform: translateY(-50%) rotate(45deg); | |
| } | |
| .slide-content { display: flex; min-height: 296px; flex-direction: column; justify-content: center; padding: 28px 32px; } | |
| .slide-content h3 { | |
| max-width: 360px; margin: 0 0 22px !important; color: var(--col) !important; | |
| font-size: clamp(26px, 3vw, 39px) !important; line-height: 1.03 !important; letter-spacing: -.04em !important; | |
| } | |
| .slide-content ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; } | |
| .rename-visual { box-shadow: 16px 18px 0 var(--action-soft); } | |
| .rename-bar { min-height: 42px; padding: 0 16px; } | |
| .rename-body { padding: 22px; } | |
| .rename-row { | |
| display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); | |
| gap: 12px; align-items: center; min-height: 64px; border-bottom: 1px solid var(--rule); | |
| } | |
| .rename-row:last-child { border-bottom: 0; } | |
| .rename-old { color: var(--muted); font-size: 12px; } | |
| .rename-new { color: var(--col); font-size: 13px; font-weight: 800; } | |
| .rename-arrow { position: relative; height: 2px; background: var(--action); } | |
| .section-title { | |
| display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px; padding: 42px 0 18px; | |
| } | |
| .section-index { padding-top: 6px; border-top: 3px solid var(--action); color: var(--action-dark); font-size: 13px; font-weight: 800; } | |
| .section-title h2 { margin: 0 !important; color: var(--col) !important; font-size: 32px !important; font-weight: 750 !important; letter-spacing: -.035em !important; } | |
| .section-title p { max-width: 720px; margin: 5px 0 0 !important; color: var(--muted) !important; font-size: 13px !important; line-height: 1.55 !important; } | |
| .workbench-shell, .mapping-shell, .export-shell { | |
| overflow: hidden !important; gap: 0 !important; border: 1px solid var(--rule) !important; | |
| border-radius: 8px !important; background: var(--paper) !important; | |
| } | |
| .source-pane, .template-pane, .upload-pane, .guide-pane, .export-shell { padding: 28px !important; background: var(--paper) !important; } | |
| .source-pane, .upload-pane { border-right: 1px solid var(--rule) !important; } | |
| .workbench-grid { gap: 0 !important; align-items: stretch !important; } | |
| .pane-heading { margin-bottom: 20px; } | |
| .pane-heading h3 { margin: 0 !important; color: var(--col) !important; font-size: 18px !important; letter-spacing: -.02em !important; } | |
| .pane-heading p { max-width: 520px; margin: 5px 0 0 !important; color: var(--muted) !important; font-size: 12px !important; line-height: 1.55 !important; } | |
| .input-mode label { border-radius: 4px !important; } | |
| .file-drop, .markdown-editor, .status-box, .result-file, .output-file, .mapping-original, .mapping-target, .mapping-check { | |
| border-color: var(--rule) !important; border-radius: 5px !important; background: var(--paper) !important; | |
| } | |
| .requirement-list { margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); } | |
| .requirement-list li { | |
| display: grid; grid-template-columns: 16px 1fr; gap: 10px; padding: 13px 0; | |
| border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 12px; line-height: 1.5; | |
| } | |
| .requirement-list li::before { content: "✓"; color: var(--action); font-weight: 800; } | |
| .convert-button, .primary-action { | |
| min-height: 58px !important; margin: 0 !important; border: 0 !important; | |
| border-top: 1px solid var(--action-dark) !important; border-radius: 0 !important; | |
| background: var(--action) !important; color: var(--paper) !important; | |
| font-size: 15px !important; font-weight: 800 !important; box-shadow: none !important; | |
| } | |
| .convert-button:hover, .primary-action:hover { background: var(--action-dark) !important; } | |
| .secondary-action, .secondary-action button { border-color: var(--rule) !important; border-radius: 4px !important; } | |
| .result-grid { gap: 12px !important; } | |
| .result-file, .output-file { min-height: 116px; } | |
| .preview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 32px 0 12px; padding-top: 24px; border-top: 1px solid var(--rule); } | |
| .preview-heading h3 { margin: 0 !important; color: var(--col) !important; font-size: 17px !important; } | |
| .preview-heading span { color: var(--muted); font-size: 12px; } | |
| .pdf-preview { overflow: hidden !important; border: 1px solid var(--rule) !important; border-radius: 5px !important; background: var(--bg) !important; } | |
| .pdf-preview img { background: var(--paper) !important; object-fit: contain !important; } | |
| .status-box { margin-top: 14px !important; overflow: hidden !important; } | |
| .examples-shell { margin-top: 34px; padding: 20px 0 0 !important; border-top: 1px solid var(--rule) !important; } | |
| .examples-shell h3 { margin: 0 0 12px !important; color: var(--col) !important; font-size: 15px !important; } | |
| .overview-empty, .overview-card { | |
| min-height: 112px; border: 1px solid var(--rule); border-radius: 5px; | |
| background: var(--bg); padding: 18px 20px; | |
| } | |
| .overview-empty { display: flex; flex-direction: column; justify-content: center; } | |
| .overview-empty strong, .overview-card strong { color: var(--col); font-size: 14px; } | |
| .overview-empty p { margin: 5px 0 0; color: var(--muted); font-size: 12px; } | |
| .overview-kicker { display: block; margin-bottom: 6px; color: var(--action-dark); font-size: 10px; font-weight: 800; letter-spacing: .08em; } | |
| .overview-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; } | |
| .overview-metrics { display: flex; gap: 20px; } | |
| .overview-metrics div { min-width: 68px; padding-left: 12px; border-left: 1px solid var(--rule); } | |
| .overview-metrics b { display: block; color: var(--col); font-size: 20px; line-height: 1.1; } | |
| .overview-metrics span { color: var(--muted); font-size: 10px; } | |
| .mapping-shell { padding: 0 !important; } | |
| .mapping-toolbar { padding: 18px 20px !important; border-bottom: 1px solid var(--rule) !important; align-items: center !important; } | |
| .mapping-toolbar-note { color: var(--muted); font-size: 12px; line-height: 1.5; } | |
| .mapping-list { padding: 0 20px 20px !important; } | |
| .mapping-head, .mapping-row { display: grid !important; grid-template-columns: minmax(250px, 1.35fr) minmax(210px, .9fr) minmax(130px, .55fr); gap: 12px !important; } | |
| .mapping-head { padding: 10px 20px; border-bottom: 1px solid var(--rule); background: var(--bg); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; } | |
| .mapping-row { align-items: start !important; padding: 14px 0 !important; border-bottom: 1px solid var(--rule) !important; } | |
| .mapping-row:last-child { border-bottom: 0 !important; } | |
| .mapping-original input { font-family: "SFMono-Regular", Consolas, monospace !important; } | |
| .contract-report, .contract-empty { margin-top: 14px; overflow: hidden; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); } | |
| .contract-empty { padding: 24px; } | |
| .contract-empty > span, .contract-summary span { display: block; margin-bottom: 5px; color: var(--action-dark); font-size: 10px; font-weight: 800; letter-spacing: .08em; } | |
| .contract-empty strong { display: block; color: var(--col); font-size: 15px; } | |
| .contract-empty p { margin: 5px 0 0; color: var(--muted); font-size: 12px; } | |
| .contract-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--rule); } | |
| .contract-summary.summary-fail { background: var(--danger-soft); } | |
| .contract-summary.summary-warning { background: var(--warn-soft); } | |
| .contract-summary.summary-pass { background: var(--success-soft); } | |
| .contract-summary strong { color: var(--col); font-size: 14px; } | |
| .contract-summary small { color: var(--muted); font-size: 10px; text-align: right; } | |
| .contract-head, .contract-row { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(220px, 1.1fr) minmax(300px, 1.6fr); gap: 18px; } | |
| .contract-head { padding: 9px 20px; border-bottom: 1px solid var(--rule); background: var(--bg); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; } | |
| .contract-row { padding: 16px 20px; border-bottom: 1px solid var(--rule); } | |
| .contract-layout { display: flex; gap: 10px; align-items: flex-start; } | |
| .contract-index { min-width: 28px; padding-top: 3px; border-top: 2px solid var(--action); color: var(--action-dark); font-size: 10px; font-weight: 800; } | |
| .contract-layout strong { display: block; color: var(--col); font-size: 12px; } | |
| .contract-layout small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; } | |
| .contract-found { color: var(--muted); font-size: 11px; line-height: 1.55; } | |
| .contract-badge { display: inline-flex; padding: 3px 7px; border-radius: 5px; font-size: 9px; font-weight: 900; letter-spacing: .06em; } | |
| .contract-pass { background: #dcfce7; color: var(--success); } | |
| .contract-warning { background: #fef3c7; color: var(--warn); } | |
| .contract-fail { background: #fee2e2; color: var(--danger); } | |
| .contract-checks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; } | |
| .contract-check { padding: 3px 6px; border: 1px solid var(--rule); border-radius: 4px; font-size: 10px; } | |
| .contract-check.ok { color: var(--success); border-color: #bbf7d0; background: var(--success-soft); } | |
| .contract-check.warn { color: var(--warn); border-color: #fde68a; background: var(--warn-soft); } | |
| .contract-check.bad { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); } | |
| .contract-messages { margin: 8px 0 0; padding-left: 17px; color: var(--muted); font-size: 10px; line-height: 1.55; } | |
| .contract-footnote { padding: 14px 20px; background: var(--bg); color: var(--muted); font-size: 10px; line-height: 1.6; } | |
| .contract-footnote strong { color: var(--col); } | |
| .site-footer { display: flex; justify-content: space-between; gap: 18px; padding: 34px 0 0; color: #64748b; font-size: 12px; } | |
| .site-footer a { color: var(--action-dark) !important; text-underline-offset: 3px; } | |
| .live-hero-grid { padding-top: clamp(50px, 7vw, 82px); padding-bottom: clamp(50px, 7vw, 82px); } | |
| .live-transform-visual .source-sheet { transform: rotate(-1deg); } | |
| .live-transform-visual .slide-canvas { transform: translateY(8px); } | |
| .live-cursor-label, .live-preview-label { color: var(--action-dark); font-weight: 800; letter-spacing: .05em; } | |
| .live-caret { | |
| display: inline-block; width: 2px; height: 12px; margin-left: 3px; | |
| transform: translateY(2px); background: var(--action); | |
| } | |
| .live-workbench { padding: 0 !important; } | |
| .live-workspace { gap: 0 !important; align-items: stretch !important; } | |
| .live-pane { gap: 14px !important; min-width: min(320px, 100%) !important; padding: 28px !important; } | |
| .live-preview-pane { background: var(--paper) !important; } | |
| .live-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; } | |
| .live-preview-heading > div { min-width: 0; } | |
| .live-badge { | |
| flex: 0 0 auto; padding: 4px 7px; border-radius: 4px; | |
| background: var(--action-soft); color: var(--action-dark); | |
| font-size: 9px; font-weight: 900; letter-spacing: .08em; | |
| } | |
| .live-markdown textarea { | |
| font-family: "SFMono-Regular", Consolas, "Noto Sans TC", monospace !important; | |
| font-size: 14px !important; line-height: 1.6 !important; | |
| min-height: 640px !important; resize: vertical !important; | |
| } | |
| .live-editor-actions { gap: 10px !important; } | |
| .live-template { border-color: var(--rule) !important; border-radius: 5px !important; } | |
| .live-format-note { | |
| padding: 13px 0 0; border-top: 1px solid var(--rule); | |
| color: var(--muted); font-size: 11px; line-height: 1.6; | |
| } | |
| .live-gallery { background: var(--paper) !important; border: 1px solid var(--rule) !important; } | |
| .live-download-shell { padding: 0 !important; } | |
| .live-download-body { padding: 28px !important; background: var(--paper) !important; } | |
| .convert-button:focus-visible, .gradio-container button:focus-visible, | |
| .gradio-container input:focus-visible, .gradio-container textarea:focus-visible, | |
| .gradio-container a:focus-visible { outline: 3px solid var(--action-soft) !important; outline-offset: 2px !important; } | |
| @media (max-width: 900px) { | |
| .hero-grid { grid-template-columns: 1fr; } | |
| .transform-visual, .rename-visual { max-width: 680px; } | |
| .contract-head { display: none; } | |
| .contract-row { grid-template-columns: 1fr; gap: 10px; } | |
| } | |
| @media (max-width: 760px) { | |
| .mapping-head { display: none !important; } | |
| .mapping-row { grid-template-columns: 1fr !important; } | |
| .source-pane, .upload-pane { border-right: 0 !important; border-bottom: 1px solid var(--rule) !important; } | |
| .live-workspace .source-pane { border-bottom: 1px solid var(--rule) !important; } | |
| .overview-card { align-items: flex-start; flex-direction: column; } | |
| } | |
| @media (max-width: 620px) { | |
| .gradio-container { padding: 0 14px 36px !important; } | |
| .topbar { min-height: 62px; align-items: flex-start; flex-direction: column; padding: 14px 0; } | |
| .topbar-actions { width: 100%; justify-content: space-between; } | |
| .hero-grid { gap: 42px; padding: 48px 0 58px; } | |
| .hero-copy h1 { font-size: 48px !important; } | |
| .transform-visual { grid-template-columns: .86fr 28px 1.14fr; } | |
| .source-sheet, .slide-canvas { min-height: 230px; } | |
| .slide-canvas { box-shadow: 8px 10px 0 var(--action-soft); } | |
| .sheet-lines { overflow: hidden; padding: 18px 12px; font-size: 9px; white-space: nowrap; } | |
| .slide-content { min-height: 206px; padding: 18px; } | |
| .slide-content h3 { font-size: 22px !important; } | |
| .section-title { grid-template-columns: 44px minmax(0, 1fr); gap: 14px; } | |
| .section-title h2 { font-size: 27px !important; } | |
| .source-pane, .template-pane, .upload-pane, .guide-pane, .export-shell { padding: 20px !important; } | |
| .live-pane, .live-download-body { padding: 20px !important; } | |
| .preview-heading, .site-footer { align-items: flex-start; flex-direction: column; } | |
| } | |
| @media (prefers-reduced-motion: reduce) { | |
| *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } | |
| } | |
| """ | |
| studio_theme = gr.themes.Soft( | |
| primary_hue="blue", | |
| secondary_hue="slate", | |
| neutral_hue="slate", | |
| ).set( | |
| body_background_fill="#f8fafc", | |
| body_background_fill_dark="#f8fafc", | |
| body_text_color="#1e293b", | |
| body_text_color_dark="#1e293b", | |
| body_text_color_subdued="#475569", | |
| body_text_color_subdued_dark="#475569", | |
| background_fill_primary="#ffffff", | |
| background_fill_primary_dark="#ffffff", | |
| background_fill_secondary="#f8fafc", | |
| background_fill_secondary_dark="#f8fafc", | |
| border_color_primary="#e2e8f0", | |
| border_color_primary_dark="#e2e8f0", | |
| block_background_fill="#ffffff", | |
| block_background_fill_dark="#ffffff", | |
| block_border_color="#e2e8f0", | |
| block_border_color_dark="#e2e8f0", | |
| block_label_background_fill="#f8fafc", | |
| block_label_background_fill_dark="#f8fafc", | |
| block_label_text_color="#1e293b", | |
| block_label_text_color_dark="#1e293b", | |
| input_background_fill="#ffffff", | |
| input_background_fill_dark="#ffffff", | |
| input_border_color="#e2e8f0", | |
| input_border_color_dark="#e2e8f0", | |
| panel_background_fill="#ffffff", | |
| panel_background_fill_dark="#ffffff", | |
| ) | |