Add Apple-inspired Flat Design style

This commit is contained in:
2026-03-12 03:13:17 -04:00
parent 1472c14d44
commit fc3e81c2d6
4 changed files with 624 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ 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
python generate_report.py --style flat --output report.html
```
Generate report with legacy Platinum template:
@@ -39,19 +40,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, material)
- **modern.html**: Unified template for modern styles (brutalism, glassmorphism, neumorphism, material, flat)
- **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, material)
- CSS definitions for each modern style (brutalism, glassmorphism, neumorphism, material, flat)
- 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, material)
- A single common script is used for each modern style (brutalism, glassmorphism, neumorphism, material, flat)
- Theme configurations (colors, fonts, chart options) injected via `__THEME_CONFIG__`
- Data inserted via `__ALL_GAMES__` and `__TOP_N__`

View File

@@ -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", "material"]
MODERN_STYLES = ["brutalism", "glassmorphism", "neumorphism", "material", "flat"]
def load_template(template_file: str) -> str:
@@ -225,9 +225,9 @@ def main():
)
parser.add_argument(
"--style",
choices=["brutalism", "glassmorphism", "neumorphism", "material"],
choices=["brutalism", "glassmorphism", "neumorphism", "material", "flat"],
default=None,
help="Modern style to use (brutalism, glassmorphism, neumorphism, material). Overrides --template."
help="Modern style to use (brutalism, glassmorphism, neumorphism, material, flat). Overrides --template."
)
args = parser.parse_args()

View File

@@ -109,6 +109,28 @@ THEME_CONFIGS = {
"tooltipBorderWidth": 0,
"tooltipCornerRadius": 4,
"uppercaseTooltip": False
},
"flat": {
"colors": [
"#ffadad", "#ffd6a5", "#fdffb6", "#caffbf", "#9bf6ff",
"#a0c4ff", "#bdb2ff", "#ffc6ff", "#ff9aa2", "#e2f0cb",
"#b5ead7"
],
"fontFamily": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
"fontWeight": "500",
"pointStyle": "circle",
"textColorLight": "#1d1d1f",
"textColorDark": "#f5f5f7",
"borderColorLight": "#ffffff",
"borderColorDark": "#1c1c1e",
"borderWidth": 2,
"tooltipBg": "rgba(0, 0, 0, 0.8)",
"tooltipTitleColor": "#ffffff",
"tooltipBodyColor": "#ffffff",
"tooltipBorderColor": "transparent",
"tooltipBorderWidth": 0,
"tooltipCornerRadius": 12,
"uppercaseTooltip": False
}
}

595
templates/flat.css Normal file
View File

@@ -0,0 +1,595 @@
/***************************************************************************************************
* 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 {
/* Light Mode Variables */
--bg-base: #f5f5f7; /* Apple-like light gray background */
--bg-primary: #ffffff;
--bg-secondary: #f0f0f5;
--bg-tertiary: #e5e5ea;
--text-primary: #1d1d1f; /* Almost black */
--text-secondary: #86868b;
--text-muted: #aeaeb2;
--border-color: #d2d2d7;
--shadow-color: rgba(0, 0, 0, 0.05);
/* Pastel Accent Colors */
--accent-color: #007aff; /* Apple Blue */
--accent-hover: #0062cc;
--accent-secondary: #5ac8fa; /* Apple Light Blue */
/* Selection */
--selection-bg: rgba(0, 122, 255, 0.1);
--selection-text: #007aff;
/* UI metrics */
--card-radius: 12px;
--button-radius: 8px;
--border-width: 1px;
}
[data-theme="dark"] {
/* Dark Mode Variables */
--bg-base: #000000;
--bg-primary: #1c1c1e;
--bg-secondary: #2c2c2e;
--bg-tertiary: #3a3a3c;
--text-primary: #f5f5f7;
--text-secondary: #86868b;
--text-muted: #636366;
--border-color: #38383a;
--shadow-color: rgba(0, 0, 0, 0.2);
--accent-color: #0a84ff; /* Apple Dark Mode Blue */
--accent-hover: #409cff;
--selection-bg: rgba(10, 132, 255, 0.15);
--selection-text: #0a84ff;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg-base: #000000;
--bg-primary: #1c1c1e;
--bg-secondary: #2c2c2e;
--bg-tertiary: #3a3a3c;
--text-primary: #f5f5f7;
--text-secondary: #86868b;
--text-muted: #636366;
--border-color: #38383a;
--shadow-color: rgba(0, 0, 0, 0.2);
--accent-color: #0a84ff;
--accent-hover: #409cff;
--selection-bg: rgba(10, 132, 255, 0.15);
--selection-text: #0a84ff;
}
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 15px; /* Slightly larger for readability */
max-width: 1200px;
margin: 0 auto;
padding: 20px;
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;
-webkit-font-smoothing: antialiased;
}
/* Theme Toggle Button */
.theme-toggle {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
width: 44px;
height: 44px;
border-radius: 50%;
border: 1px solid var(--border-color);
background: var(--bg-primary);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
box-shadow: 0 2px 8px var(--shadow-color);
transition: all 0.2s ease;
color: var(--text-primary);
}
.theme-toggle:hover {
background: var(--bg-secondary);
transform: translateY(-1px);
}
.theme-toggle:active {
transform: translateY(0);
}
.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);
border: 1px solid var(--border-color);
box-shadow: 0 4px 12px var(--shadow-color);
margin-bottom: 24px;
overflow: hidden;
transition: box-shadow 0.3s ease;
}
.card:hover {
box-shadow: 0 6px 16px var(--shadow-color);
}
.card-header {
padding: 16px 24px;
border-bottom: 1px solid var(--border-color);
background: var(--bg-primary); /* Flat header */
}
.card-title {
font-size: 17px; /* Apple uses specific sizing */
font-weight: 600;
color: var(--text-primary);
letter-spacing: -0.01em;
}
.card-content {
padding: 24px;
}
.summaries-content {
padding: 0;
padding-top: 0; /* Tabs sit flush */
}
/* 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: 20px; /* Pill shape */
background: var(--bg-secondary);
border: 1px solid transparent;
transition: all 0.2s ease;
font-weight: 500;
font-size: 13px;
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: 4px; /* Rounded checkbox */
border: 1px solid var(--text-muted);
background: var(--bg-primary);
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: 6px;
top: 2px;
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-secondary);
border-radius: var(--card-radius);
min-width: 160px;
border: 1px solid transparent; /* Prepare for border */
}
.stat-value {
font-size: 32px;
font-weight: 700;
color: var(--accent-color);
font-variant-numeric: tabular-nums;
letter-spacing: -0.02em;
}
.stat-label {
font-size: 13px;
color: var(--text-secondary);
margin-top: 4px;
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: 20px;
background: var(--bg-primary);
border-radius: var(--card-radius);
border: 1px solid var(--border-color);
}
.chart-title {
font-size: 15px;
font-weight: 600;
text-align: center;
margin-bottom: 16px;
color: var(--text-primary);
}
@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 24px;
margin-bottom: 0;
position: relative;
z-index: 1;
background: var(--bg-primary);
border-bottom: 1px solid var(--border-color);
}
.tab {
padding: 14px 0;
margin-right: 24px;
cursor: pointer;
color: var(--text-secondary);
font-weight: 500;
font-size: 14px;
background: transparent;
border-bottom: 2px solid transparent;
transition: color 0.2s, border-bottom-color 0.2s;
}
.tab:hover {
color: var(--text-primary);
}
.tab.active {
color: var(--accent-color);
border-bottom: 2px solid var(--accent-color);
}
.tab-content {
background: var(--bg-primary);
padding: 0;
}
.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: 12px 24px;
text-align: left;
font-weight: 600;
color: var(--text-secondary);
border-bottom: 1px solid var(--border-color);
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
td {
padding: 12px 24px;
border-bottom: 1px solid var(--border-color);
color: var(--text-primary);
height: 48px;
}
tr:hover td {
background: var(--bg-secondary);
}
tr:last-child td {
border-bottom: none;
}
.time {
font-variant-numeric: tabular-nums;
font-weight: 500;
}
.percent {
font-variant-numeric: tabular-nums;
text-align: right;
color: var(--text-secondary);
}
.color-box {
display: inline-block;
width: 10px;
height: 10px;
margin-right: 12px;
vertical-align: middle;
border-radius: 2px; /* Slight rounding */
}
.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-muted);
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
margin-right: 10px;
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 {
padding: 0 16px;
overflow-x: auto;
}
.tab {
padding: 12px 0;
margin-right: 16px;
white-space: nowrap;
}
}
/* Scroll to Top Button */
.scroll-top {
position: fixed;
bottom: 24px;
right: 24px;
z-index: 1000;
width: 44px;
height: 44px;
border-radius: 50%;
border: 1px solid var(--border-color);
background: var(--bg-primary);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 8px var(--shadow-color);
opacity: 0;
visibility: hidden;
transition: all 0.2s ease;
color: var(--text-primary);
}
.scroll-top.visible {
opacity: 1;
visibility: visible;
}
.scroll-top:hover {
transform: translateY(-2px);
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;
}