UNPKG

ccusage-widget

Version:

A beautiful macOS desktop widget that displays your Claude Code usage statistics in real-time

296 lines (251 loc) 4.61 kB
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; font-size: 13px; color: #e0e0e0; background: transparent; user-select: none; overflow: hidden; } .widget-container { background: rgba(30, 30, 30, 0.95); backdrop-filter: blur(20px); border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); height: 100vh; display: flex; flex-direction: column; border: 1px solid rgba(255, 255, 255, 0.1); } .widget-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); -webkit-app-region: drag; } .widget-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #ffffff; } .icon { color: #4a9eff; } .widget-controls { display: flex; gap: 8px; -webkit-app-region: no-drag; } .control-btn { background: transparent; border: none; color: #999; cursor: pointer; padding: 4px; border-radius: 4px; transition: all 0.2s; } .control-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; } .widget-content { flex: 1; padding: 16px; overflow-y: auto; min-height: 0; } .loading, .error { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; color: #999; } .spinner { width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, 0.1); border-top-color: #4a9eff; border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } } .error { color: #ff4a4a; } .usage-stats { display: flex; flex-direction: column; gap: 12px; } .stat-card { background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 12px; border: 1px solid rgba(255, 255, 255, 0.1); transition: all 0.2s; } .stat-card:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); } .stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; } .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #999; } .stat-models { font-size: 10px; color: #666; } .block-time { font-size: 10px; color: #666; } .stat-value { display: flex; justify-content: space-between; align-items: baseline; } .tokens { font-size: 18px; font-weight: 600; color: #fff; } .tokens::after { content: ' tokens'; font-size: 11px; color: #666; margin-left: 4px; } .blocks-count { font-size: 18px; font-weight: 600; color: #fff; } .blocks-count::after { content: ' tokens'; font-size: 11px; color: #666; margin-left: 4px; } .cost { font-size: 16px; font-weight: 600; color: #4a9eff; } .today .cost { color: #4aff88; } .month .cost { color: #ffa54a; } .blocks .cost { color: #9a4aff; } .recent-sessions { margin-top: 8px; } .sessions-header { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #999; margin-bottom: 8px; } .sessions-list { display: flex; flex-direction: column; gap: 6px; } .session-item { background: rgba(255, 255, 255, 0.03); border-radius: 6px; padding: 8px; font-size: 11px; display: flex; justify-content: space-between; align-items: center; } .session-name { color: #ccc; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .session-cost { color: #4a9eff; font-weight: 500; } .widget-footer { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 10px; color: #666; } .last-updated { flex: 1; } .opacity-control { display: flex; align-items: center; gap: 8px; } #opacity-slider { width: 60px; height: 4px; -webkit-appearance: none; background: rgba(255, 255, 255, 0.1); border-radius: 2px; outline: none; } #opacity-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; background: #4a9eff; border-radius: 50%; cursor: pointer; } #opacity-slider::-webkit-slider-thumb:hover { background: #5aafff; transform: scale(1.2); } /* Scrollbar styles */ ::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 3px; } ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; } ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }