|
| 1 | +--- |
| 2 | +title: Graph Styling |
| 3 | +description: How to customize graph backgrounds, borders, line/bar colors, and class-based CSS |
| 4 | +--- |
| 5 | + |
| 6 | +# Graph Styling |
| 7 | + |
| 8 | +This guide explains how to apply custom CSS to graph elements. |
| 9 | + |
| 10 | +## Basic Workflow |
| 11 | + |
| 12 | +Graph elements support class assignment, just like keys and stat items. |
| 13 | + |
| 14 | +1. Select a graph element. |
| 15 | +2. Enter a class name in the **Class** field in the properties panel. |
| 16 | +3. Target that class in custom CSS. |
| 17 | + |
| 18 | +```css |
| 19 | +.kps-graph { |
| 20 | + backdrop-filter: blur(6px); |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | +## Inline Style Priority vs CSS Priority |
| 25 | + |
| 26 | +When **Inline Styles Priority** is enabled, property panel values take precedence. |
| 27 | +For graphs, **Inline Styles Priority is disabled by default**, so CSS-variable-based control works immediately. |
| 28 | + |
| 29 | +<Callout type="info"> |
| 30 | + Recommended: use class selectors to style specific graphs instead of broad global selectors. |
| 31 | +</Callout> |
| 32 | + |
| 33 | +## Graph CSS Variables |
| 34 | + |
| 35 | +Available graph variables: |
| 36 | + |
| 37 | +| Variable | Description | Type | Example | |
| 38 | +| ---------------- | ---------------------- | ---------- | ------------------------ | |
| 39 | +| `--graph-bg` | Graph background | `<color>` | `rgba(17, 17, 20, 0.85)` | |
| 40 | +| `--graph-border` | Graph border | `<border>` | `1px solid #7dd3fc` | |
| 41 | +| `--graph-radius` | Graph corner radius | `<length>` | `10px` | |
| 42 | +| `--graph-color` | Line/bar drawing color | `<color>` | `#86efac` | |
| 43 | + |
| 44 | +### Example |
| 45 | + |
| 46 | +```css |
| 47 | +.kps-graph { |
| 48 | + --graph-bg: rgba(7, 10, 18, 0.72); |
| 49 | + --graph-border: 1px solid rgba(125, 211, 252, 0.55); |
| 50 | + --graph-radius: 12px; |
| 51 | + --graph-color: #7dd3fc; |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +## Style Examples |
| 56 | + |
| 57 | +### Borderless Glass Panel |
| 58 | + |
| 59 | +```css |
| 60 | +.kps-graph { |
| 61 | + --graph-bg: rgba(10, 14, 24, 0.42); |
| 62 | + --graph-border: none; |
| 63 | + --graph-radius: 14px; |
| 64 | + --graph-color: #93c5fd; |
| 65 | + backdrop-filter: blur(8px); |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Retro Terminal Style |
| 70 | + |
| 71 | +```css |
| 72 | +.retro-graph { |
| 73 | + --graph-bg: rgba(6, 18, 6, 0.78); |
| 74 | + --graph-border: 1px solid #22c55e; |
| 75 | + --graph-radius: 6px; |
| 76 | + --graph-color: #22c55e; |
| 77 | + box-shadow: 0 0 8px rgba(34, 197, 94, 0.35) inset; |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +## Notes |
| 82 | + |
| 83 | +- Graph position offsets use the same variables as keys: `--key-offset-x`, `--key-offset-y`. |
| 84 | +- To completely hide the border, use `--graph-border: none;` or set border width to `0` in the properties panel. |
0 commit comments