From 1472c14d4473bc724d06a0e9c3676005602a0c08 Mon Sep 17 00:00:00 2001 From: Miguel Astor Date: Sun, 8 Mar 2026 12:36:14 -0400 Subject: [PATCH] Add Material Design style --- CLAUDE.md | 7 +- generate_report.py | 6 +- styles.py | 22 ++ templates/material.css | 607 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 636 insertions(+), 6 deletions(-) create mode 100644 templates/material.css diff --git a/CLAUDE.md b/CLAUDE.md index 5aa028a..ff6f7eb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,6 +18,7 @@ Generate report with modern style: python generate_report.py --style glassmorphism --output report.html python generate_report.py --style brutalism --output report.html python generate_report.py --style neumorphism --output report.html +python generate_report.py --style material --output report.html ``` Generate report with legacy Platinum template: @@ -38,19 +39,19 @@ python generate_report.py --db pga.db --output report.html --top 10 --background - Loads HTML template from `templates/` folder (default: `templates/platinum.html`) **HTML templates (`templates/`):** -- **modern.html**: Unified template for modern styles (brutalism, glassmorphism, neumorphism) +- **modern.html**: Unified template for modern styles (brutalism, glassmorphism, neumorphism, material) - **platinum.html**: Legacy Mac OS 9 Platinum visual style (separate template due to unique structure) - All templates use Chart.js doughnut charts and dynamic JavaScript filtering - Placeholder tokens like `__ALL_GAMES__`, `__BACKGROUND_IMAGE__` are replaced at generation time - Modern templates support light/dark/auto theme toggle button **Style system (`styles.py`):** -- CSS definitions for each modern style (brutalism, glassmorphism, neumorphism) +- CSS definitions for each modern style (brutalism, glassmorphism, neumorphism, material) - Theme configurations (colors, fonts, chart options) injected via `__THEME_CSS__` - Use `--style` argument to select a modern style instead of `--template` **Javascript (`templates/script.js`):** -- A single common script is used for each modern style (brutalism, glassmorphism, neumorphism) +- A single common script is used for each modern style (brutalism, glassmorphism, neumorphism, material) - Theme configurations (colors, fonts, chart options) injected via `__THEME_CONFIG__` - Data inserted via `__ALL_GAMES__` and `__TOP_N__` diff --git a/generate_report.py b/generate_report.py index 8467f0d..60b7964 100644 --- a/generate_report.py +++ b/generate_report.py @@ -27,7 +27,7 @@ from styles import get_theme_css, get_theme_config SCRIPT_DIR = Path(__file__).parent # Modern styles that use the unified template -MODERN_STYLES = ["brutalism", "glassmorphism", "neumorphism"] +MODERN_STYLES = ["brutalism", "glassmorphism", "neumorphism", "material"] def load_template(template_file: str) -> str: @@ -225,9 +225,9 @@ def main(): ) parser.add_argument( "--style", - choices=["brutalism", "glassmorphism", "neumorphism"], + choices=["brutalism", "glassmorphism", "neumorphism", "material"], default=None, - help="Modern style to use (brutalism, glassmorphism, neumorphism). Overrides --template." + help="Modern style to use (brutalism, glassmorphism, neumorphism, material). Overrides --template." ) args = parser.parse_args() diff --git a/styles.py b/styles.py index 81d8424..91e844f 100644 --- a/styles.py +++ b/styles.py @@ -87,6 +87,28 @@ THEME_CONFIGS = { "tooltipBorderWidth": 0, "tooltipCornerRadius": 8, "uppercaseTooltip": False + }, + "material": { + "colors": [ + "#6200ee", "#03dac6", "#3700b3", "#018786", "#b00020", + "#ff0266", "#aa00ff", "#0091ea", "#00c853", "#ffd600", + "#757575" + ], + "fontFamily": "'Roboto', sans-serif", + "fontWeight": "normal", + "pointStyle": "circle", + "textColorLight": "#212121", + "textColorDark": "#ffffff", + "borderColorLight": "#ffffff", + "borderColorDark": "#1e1e1e", + "borderWidth": 2, + "tooltipBg": "rgba(97, 97, 97, 0.9)", + "tooltipTitleColor": "#ffffff", + "tooltipBodyColor": "#ffffff", + "tooltipBorderColor": "transparent", + "tooltipBorderWidth": 0, + "tooltipCornerRadius": 4, + "uppercaseTooltip": False } } diff --git a/templates/material.css b/templates/material.css new file mode 100644 index 0000000..f084e53 --- /dev/null +++ b/templates/material.css @@ -0,0 +1,607 @@ +/*************************************************************************************************** + * Copyright (C) 2026 by WallyHackenslacker wallyhackenslacker@noreply.git.hackenslacker.space * + * * + * Permission to use, copy, modify, and/or distribute this software for any purpose with or without * + * fee is hereby granted. * + * * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * + * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE * + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * + * OF THIS SOFTWARE. * + ****************************************************************************************************/ + +:root { + --bg-base: #fafafa; + --bg-primary: #ffffff; + --bg-secondary: #f5f5f5; + --bg-tertiary: #eeeeee; + --text-primary: #212121; + --text-secondary: #757575; + --text-muted: #bdbdbd; + --border-color: #e0e0e0; + --shadow-color: rgba(0, 0, 0, 0.2); + --accent-color: #6200ee; + --accent-hover: #3700b3; + --accent-secondary: #03dac6; + --selection-bg: rgba(98, 0, 238, 0.12); + --selection-text: #6200ee; + --card-radius: 4px; + --elevation-1: 0 2px 1px -1px rgba(0,0,0,0.2), 0 1px 1px 0 rgba(0,0,0,0.14), 0 1px 3px 0 rgba(0,0,0,0.12); + --elevation-2: 0 3px 1px -2px rgba(0,0,0,0.2), 0 2px 2px 0 rgba(0,0,0,0.14), 0 1px 5px 0 rgba(0,0,0,0.12); + --elevation-4: 0 2px 4px -1px rgba(0,0,0,0.2), 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12); +} + +[data-theme="dark"] { + --bg-base: #121212; + --bg-primary: #1e1e1e; + --bg-secondary: #2d2d2d; + --bg-tertiary: #383838; + --text-primary: #ffffff; + --text-secondary: #b0b0b0; + --text-muted: #707070; + --border-color: #383838; + --shadow-color: rgba(0, 0, 0, 0.4); + --accent-color: #bb86fc; + --accent-hover: #9965f4; + --accent-secondary: #03dac6; + --selection-bg: rgba(187, 134, 252, 0.12); + --selection-text: #bb86fc; + --elevation-1: 0 2px 1px -1px rgba(0,0,0,0.4), 0 1px 1px 0 rgba(0,0,0,0.28), 0 1px 3px 0 rgba(0,0,0,0.24); + --elevation-2: 0 3px 1px -2px rgba(0,0,0,0.4), 0 2px 2px 0 rgba(0,0,0,0.28), 0 1px 5px 0 rgba(0,0,0,0.24); + --elevation-4: 0 2px 4px -1px rgba(0,0,0,0.4), 0 4px 5px 0 rgba(0,0,0,0.28), 0 1px 10px 0 rgba(0,0,0,0.24); +} + +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --bg-base: #121212; + --bg-primary: #1e1e1e; + --bg-secondary: #2d2d2d; + --bg-tertiary: #383838; + --text-primary: #ffffff; + --text-secondary: #b0b0b0; + --text-muted: #707070; + --border-color: #383838; + --shadow-color: rgba(0, 0, 0, 0.4); + --accent-color: #bb86fc; + --accent-hover: #9965f4; + --accent-secondary: #03dac6; + --selection-bg: rgba(187, 134, 252, 0.12); + --selection-text: #bb86fc; + --elevation-1: 0 2px 1px -1px rgba(0,0,0,0.4), 0 1px 1px 0 rgba(0,0,0,0.28), 0 1px 3px 0 rgba(0,0,0,0.24); + --elevation-2: 0 3px 1px -2px rgba(0,0,0,0.4), 0 2px 2px 0 rgba(0,0,0,0.28), 0 1px 5px 0 rgba(0,0,0,0.24); + --elevation-4: 0 2px 4px -1px rgba(0,0,0,0.4), 0 4px 5px 0 rgba(0,0,0,0.28), 0 1px 10px 0 rgba(0,0,0,0.24); + } +} + +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; + font-size: 14px; + max-width: 1200px; + margin: 0 auto; + padding: 24px; + background-color: var(--bg-base); + background-image: url('__BACKGROUND_IMAGE__'); + background-size: cover; + background-position: center; + background-attachment: fixed; + min-height: 100vh; + color: var(--text-primary); + line-height: 1.5; + transition: background-color 0.3s ease, color 0.3s ease; +} + +/* Theme Toggle Button */ +.theme-toggle { + position: fixed; + top: 24px; + right: 24px; + z-index: 1000; + width: 48px; + height: 48px; + border-radius: 50%; + border: none; + background: var(--bg-primary); + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + font-size: 24px; + box-shadow: var(--elevation-2); + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); + color: var(--text-primary); +} + +.theme-toggle:hover { + box-shadow: var(--elevation-4); + background: var(--bg-secondary); +} + +.theme-toggle:active { + box-shadow: var(--elevation-1); +} + +.theme-toggle .icon-auto { + position: relative; + width: 24px; + height: 24px; + display: flex; + align-items: center; + justify-content: center; +} + +.theme-toggle .icon-auto::before, +.theme-toggle .icon-auto::after { + position: absolute; + font-size: 20px; + line-height: 1; +} + +.theme-toggle .icon-auto::before { + content: '☀️'; + clip-path: inset(0 50% 0 0); +} + +.theme-toggle .icon-auto::after { + content: '🌙'; + clip-path: inset(0 0 0 50%); +} + +/* Card Style */ +.card { + background: var(--bg-primary); + border-radius: var(--card-radius); + box-shadow: var(--elevation-1); + margin-bottom: 24px; + overflow: hidden; + transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1); +} + +.card:hover { + box-shadow: var(--elevation-2); +} + +.card-header { + padding: 16px 24px; + border-bottom: 1px solid var(--border-color); + background: var(--bg-primary); +} + +.card-title { + font-size: 20px; + font-weight: 500; + color: var(--text-primary); + letter-spacing: 0.15px; +} + +.card-content { + padding: 24px; +} + +.summaries-content { + padding: 0; + padding-top: 0; +} + +/* Filters */ +.filters { + display: flex; + justify-content: center; + gap: 12px; + flex-wrap: wrap; +} + +.filter-label { + display: flex; + align-items: center; + gap: 8px; + cursor: pointer; + user-select: none; + padding: 8px 16px; + border-radius: 16px; /* Chip style */ + background: var(--bg-secondary); + border: 1px solid transparent; + transition: background-color 0.2s, box-shadow 0.2s; + font-weight: 500; + font-size: 14px; + color: var(--text-primary); +} + +.filter-label:hover { + background: var(--bg-tertiary); +} + +.filter-label input[type="checkbox"] { + appearance: none; + -webkit-appearance: none; + width: 18px; + height: 18px; + border-radius: 2px; + border: 2px solid var(--text-secondary); + background: transparent; + cursor: pointer; + position: relative; + transition: all 0.2s ease; + margin: 0; +} + +.filter-label input[type="checkbox"]:checked { + background: var(--accent-color); + border-color: var(--accent-color); +} + +.filter-label input[type="checkbox"]:checked::after { + content: ''; + position: absolute; + left: 5px; + top: 1px; + width: 4px; + height: 9px; + border: solid white; + border-width: 0 2px 2px 0; + transform: rotate(45deg); +} + +.filter-label .service-name { + text-transform: capitalize; +} + +.filter-label .service-count { + color: var(--text-secondary); + font-size: 12px; +} + +/* Stats */ +.stats { + display: flex; + justify-content: center; + gap: 24px; + flex-wrap: wrap; +} + +.stat { + text-align: center; + padding: 24px 32px; + background: var(--bg-primary); + border-radius: var(--card-radius); + min-width: 160px; + /* No border or extra bg needed inside the card, just spacing */ +} + +.stat-value { + font-size: 34px; + font-weight: 400; + color: var(--accent-color); + font-variant-numeric: tabular-nums; + letter-spacing: 0.25px; +} + +.stat-label { + font-size: 12px; + color: var(--text-secondary); + margin-top: 4px; + text-transform: uppercase; + letter-spacing: 1.5px; + font-weight: 500; +} + +/* Charts */ +.charts-wrapper { + display: grid; + grid-auto-columns: minmax(280px, 450px); + grid-template-columns: repeat(auto-fill, minmax(280px, 450px)); + grid-gap: 24px; + justify-content: center; + flex-wrap: wrap; +} + +.chart-container { + min-width: 280px; + max-width: 450px; + padding: 16px; + background: var(--bg-primary); + border-radius: var(--card-radius); + /* Charts sit inside the main card content, so no extra background needed if not wanted, + but let's give them a subtle border or just rely on spacing. + Material design often puts charts on cards. Here they are inside a card. + Let's leave them clean. */ +} + +.chart-title { + font-size: 16px; + font-weight: 500; + text-align: center; + margin-bottom: 16px; + color: var(--text-primary); + letter-spacing: 0.15px; +} + +@media (max-width: 700px) { + .charts-wrapper { + flex-direction: column; + align-items: center; + } + .chart-container { + max-width: 100%; + width: 100%; + } +} + +/* Tabs */ +.tabs { + display: flex; + padding: 0; + margin-bottom: 0; + position: relative; + z-index: 1; + background: var(--bg-primary); + box-shadow: 0 1px 0 var(--border-color); /* Bottom border for the tab bar */ +} + +.tab { + padding: 14px 24px; + cursor: pointer; + color: var(--text-secondary); + font-weight: 500; + text-transform: uppercase; + font-size: 14px; + letter-spacing: 1.25px; + background: transparent; + border-bottom: 2px solid transparent; + transition: background-color 0.2s, color 0.2s; + flex: 1; + text-align: center; + max-width: 200px; +} + +.tab:hover { + background-color: rgba(0, 0, 0, 0.04); /* Ripple-like hover */ + color: var(--text-primary); +} + +[data-theme="dark"] .tab:hover { + background-color: rgba(255, 255, 255, 0.08); +} + +.tab.active { + color: var(--accent-color); + border-bottom: 2px solid var(--accent-color); +} + +.tab-content { + background: var(--bg-primary); + padding: 0; /* Table fills the space */ +} + +.tab-panel { + display: none; +} + +.tab-panel.active { + display: block; +} + +/* Tables */ +.table-wrapper { + overflow-x: auto; +} + +table { + width: 100%; + border-collapse: collapse; + font-size: 14px; +} + +th { + padding: 16px 24px; + text-align: left; + font-weight: 500; + color: var(--text-secondary); + border-bottom: 1px solid var(--border-color); + font-size: 12px; + text-transform: uppercase; + letter-spacing: 0.5px; /* Material column header style */ +} + +td { + padding: 14px 24px; + border-bottom: 1px solid var(--border-color); + color: var(--text-primary); + height: 52px; /* Material dense table row height */ +} + +tr:hover td { + background: var(--bg-secondary); +} + +tr:last-child td { + border-bottom: none; +} + +.time { + font-variant-numeric: tabular-nums; + font-weight: 400; +} + +.percent { + font-variant-numeric: tabular-nums; + text-align: right; + color: var(--text-secondary); +} + +.color-box { + display: inline-block; + width: 12px; + height: 12px; + margin-right: 12px; + vertical-align: middle; + border-radius: 50%; /* Circles for material */ +} + +.service-badge { + display: inline-block; + font-size: 11px; + padding: 2px 8px; + background: var(--bg-secondary); + border-radius: 4px; + color: var(--text-secondary); + margin-left: 8px; + text-transform: capitalize; + font-weight: 500; +} + +.category-badge { + display: inline-block; + font-size: 11px; + padding: 2px 8px; + background: var(--selection-bg); + border-radius: 4px; + color: var(--selection-text); + margin-left: 4px; + text-transform: capitalize; + font-weight: 500; +} + +.no-data { + text-align: center; + padding: 40px; + color: var(--text-muted); +} + +/* Others row expansion */ +.others-row { + cursor: pointer; +} + +.others-row td:first-child::before { + content: ''; + display: inline-block; + width: 0; + height: 0; + border-left: 5px solid var(--text-secondary); + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + margin-right: 12px; + transition: transform 0.2s ease; + vertical-align: middle; +} + +.others-row.expanded td:first-child::before { + transform: rotate(90deg); +} + +.others-detail { + display: none; + background: var(--bg-base); /* Slightly darker/lighter background for details */ +} + +.others-detail.visible { + display: table-row; +} + +.others-detail td { + padding-left: 48px; + font-size: 13px; + color: var(--text-secondary); +} + +/* Scrollbar */ +::-webkit-scrollbar { + width: 8px; + height: 8px; +} + +::-webkit-scrollbar-track { + background: transparent; +} + +::-webkit-scrollbar-thumb { + background: var(--text-muted); + border-radius: 4px; +} + +::-webkit-scrollbar-thumb:hover { + background: var(--text-secondary); +} + +/* Responsive */ +@media (max-width: 600px) { + body { + padding: 16px; + } + + .stats { + gap: 16px; + } + + .stat { + padding: 16px 20px; + min-width: 100px; + } + + .stat-value { + font-size: 28px; + } + + .filter-label { + padding: 6px 12px; + font-size: 13px; + } + + .tabs { + flex-wrap: wrap; + } + + .tab { + padding: 12px 16px; + font-size: 12px; + max-width: none; + } +} + +/* Scroll to Top Button */ +.scroll-top { + position: fixed; + bottom: 24px; + right: 24px; + z-index: 1000; + width: 48px; + height: 48px; + border-radius: 50%; + border: none; + background: var(--bg-primary); + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + box-shadow: var(--elevation-2); + opacity: 0; + visibility: hidden; + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); + color: var(--text-primary); +} + +.scroll-top.visible { + opacity: 1; + visibility: visible; +} + +.scroll-top:hover { + box-shadow: var(--elevation-4); + background: var(--bg-secondary); +} + +.scroll-top-arrow { + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 8px solid currentColor; +}