claude-usage-widget/src/renderer/index.html
Claude 0e46ef084e Add customizable color preferences with separate settings window
## New Features
- **Customizable Progress Bar Colors**: Users can now customize the colors for normal, warning, and danger states through a dedicated settings window
- **Separate Settings Window**: Settings now open in a frameless, resizable window (500x680px) with live preview of color changes
- **CSS Variables**: Converted hardcoded colors to CSS custom properties for dynamic theming

## Files Modified
- **main.js**: Added settings window creation, color preference storage (electron-store), and IPC handlers
- **preload.js**: Exposed color preference and settings IPC methods to renderer
- **app.js**: Implemented color preference loading and live updates from settings window
- **styles.css**: Added CSS variables for customizable colors, updated scrollbar styling
- **index.html**: Removed unused settings overlay
- **.gitignore**: Added CLAUDE_NOTES.md to prevent credential leaks

## Files Added
- **src/renderer/settings.html**: Settings window UI with 2-column color picker layout
- **src/renderer/settings.js**: Settings window logic and color management
- **src/renderer/settings-styles.css**: Settings window styling
- **CHANGES.md**: Tracking document for modifications

## Technical Details
- Color preferences stored in electron-store with encryption
- Live color updates via IPC communication between settings and main windows
- Default color scheme: Purple (normal), Orange (warning), Red (danger)
- Settings accessible via tray menu or settings button

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 13:38:45 -05:00

129 lines
No EOL
6.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Claude Usage Widget</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="app">
<div class="widget-container" id="widgetContainer">
<!-- Title Bar -->
<div class="title-bar" id="titleBar">
<div class="title">
<img src="../../assets/logo.png" alt="Logo" class="app-logo">
<span>Claude Usage</span>
</div>
<div class="controls">
<button class="control-btn settings-btn" id="settingsBtn" title="Settings">⚙️</button>
<button class="control-btn refresh-btn" id="refreshBtn" title="Refresh">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<path d="M23 4v6h-6M1 20v-6h6" />
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" />
</svg>
</button>
<button class="control-btn minimize-btn" id="minimizeBtn" title="Minimise to System Tray"></button>
<button class="control-btn close-btn" id="closeBtn" title="Exit Application">×</button>
</div>
</div>
<!-- Loading State -->
<div class="loading-container" id="loadingContainer">
<div class="spinner"></div>
<p>Loading usage data...</p>
</div>
<!-- Login Required State -->
<div class="login-container" id="loginContainer" style="display: none;">
<div class="login-content">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" />
<polyline points="10 17 15 12 10 7" />
<line x1="15" y1="12" x2="3" y2="12" />
</svg>
<div class="login-text-group">
<h3>Login Required</h3>
<p>Log in to view usage stats</p>
</div>
<button class="login-btn" id="loginBtn">Log In</button>
</div>
</div>
<!-- No Usage State -->
<div class="no-usage-container" id="noUsageContainer" style="display: none;">
<div class="no-usage-content">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
</svg>
<div class="no-usage-text-group">
<h3>No Usage Yet</h3>
<p>Start chatting with Claude to see your usage stats</p>
</div>
</div>
</div>
<!-- Auto-Login Attempt State -->
<div class="auto-login-container" id="autoLoginContainer" style="display: none;">
<div class="auto-login-content">
<div class="spinner"></div>
<div class="auto-login-text-group">
<h3>Trying to auto-login...</h3>
<p>Please wait while we reconnect</p>
</div>
</div>
</div>
<!-- Main Content -->
<div class="content" id="mainContent" style="display: none;">
<!-- Session Usage -->
<div class="usage-section">
<span class="usage-label">Current Session</span>
<div class="progress-bar">
<div class="progress-fill" id="sessionProgress" style="width: 0%"></div>
</div>
<span class="usage-percentage" id="sessionPercentage">0%</span>
<div class="timer-container">
<div class="timer-text" id="sessionTimeText">--:--</div>
<svg class="mini-timer" width="24" height="24" viewBox="0 0 24 24">
<circle class="timer-bg" cx="12" cy="12" r="10" />
<circle class="timer-progress" id="sessionTimer" cx="12" cy="12" r="10"
style="stroke-dasharray: 63; stroke-dashoffset: 63" />
</svg>
</div>
</div>
<!-- Weekly Usage -->
<div class="usage-section">
<span class="usage-label">Weekly Limit</span>
<div class="progress-bar">
<div class="progress-fill weekly" id="weeklyProgress" style="width: 0%"></div>
</div>
<span class="usage-percentage" id="weeklyPercentage">0%</span>
<div class="timer-container">
<div class="timer-text" id="weeklyTimeText">--:--</div>
<svg class="mini-timer" width="24" height="24" viewBox="0 0 24 24">
<circle class="timer-bg" cx="12" cy="12" r="10" />
<circle class="timer-progress weekly" id="weeklyTimer" cx="12" cy="12" r="10"
style="stroke-dasharray: 63; stroke-dashoffset: 63" />
</svg>
</div>
</div>
<!-- Hidden Footer element (removed) -->
<span id="lastUpdate" style="display: none;"></span>
</div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>