|
43 | 43 | }, |
44 | 44 | "outputs": [], |
45 | 45 | "source": [ |
46 | | - "mr.Markdown(\"---\\n## 2. Custom Styles Indicators\\nYou can customize the look of your indicators using semantic variants or explicit hex colors.\")\n", |
| 46 | + "mr.Markdown(\"---\")\n", |
| 47 | + "mr.Markdown(\"## 2. Built-in Variants\")\n", |
| 48 | + "mr.Markdown(\"Mercury provides built-in semantic and domain variants for quick styling.\")\n", |
47 | 49 | "\n", |
48 | | - "# Checklist Item 2: Variants\n", |
49 | | - "ind1 = mr.Indicator(value=\"98%\", label=\"ACCURACY\", variant=\"success\")\n", |
50 | | - "ind2 = mr.Indicator(value=\"340ms\", label=\"LATENCY\", variant=\"warning\")\n", |
51 | | - "ind3 = mr.Indicator(value=\"$12k\", label=\"REVENUE\", variant=\"danger\")\n", |
| 50 | + "# Using the variants exactly as the maintainer specified\n", |
| 51 | + "ind_success = mr.Indicator(value=\"98%\", label=\"ACCURACY\", variant=\"success\")\n", |
| 52 | + "ind_warning = mr.Indicator(value=\"340ms\", label=\"LATENCY\", variant=\"warning\")\n", |
| 53 | + "ind_danger = mr.Indicator(value=\"3\", label=\"ERRORS\", variant=\"danger\")\n", |
52 | 54 | "\n", |
53 | | - "display(ind1, ind2, ind3)" |
| 55 | + "display(ind_success, ind_warning, ind_danger)" |
54 | 56 | ] |
55 | 57 | }, |
56 | 58 | { |
|
64 | 66 | }, |
65 | 67 | "outputs": [], |
66 | 68 | "source": [ |
67 | | - "# Checklist Item 2: Explicit Colors\n", |
68 | | - "mr.Indicator(\n", |
69 | | - " value=\"$12,340\",\n", |
70 | | - " label=\"CUSTOM PURPLE\",\n", |
71 | | - " accent_color=\"#7c3aed\",\n", |
72 | | - " border_color=\"#ddd6fe\",\n", |
73 | | - " value_color=\"#111827\",\n", |
74 | | - " label_color=\"#6b7280\"\n", |
75 | | - ")" |
| 69 | + "import ipywidgets as widgets\n", |
| 70 | + "\n", |
| 71 | + "mr.Markdown(\"---\")\n", |
| 72 | + "mr.Markdown(\"## 3. Custom Styles Indicator\")\n", |
| 73 | + "mr.Markdown(\"For complete control, override the default styling with explicit hex colors, including the background.\")\n", |
| 74 | + "\n", |
| 75 | + "ind_dark = mr.Indicator(\n", |
| 76 | + " value=\"142 IOPS\", label=\"DISK READ\",\n", |
| 77 | + " background_color=\"#1e1e2f\", accent_color=\"#ff007f\", border_color=\"#ff007f\",\n", |
| 78 | + " value_color=\"#00ffff\", label_color=\"#aaaaaa\"\n", |
| 79 | + ")\n", |
| 80 | + "\n", |
| 81 | + "ind_pastel = mr.Indicator(\n", |
| 82 | + " value=\"8.4 hrs\", label=\"AVG SLEEP\",\n", |
| 83 | + " background_color=\"#fdf6e3\", accent_color=\"#b58900\", border_color=\"#eee8d5\",\n", |
| 84 | + " value_color=\"#657b83\", label_color=\"#93a1a1\"\n", |
| 85 | + ")\n", |
| 86 | + "\n", |
| 87 | + "ind_alert = mr.Indicator(\n", |
| 88 | + " value=\"OFFLINE\", label=\"SERVER STATUS\",\n", |
| 89 | + " background_color=\"#7f0000\", accent_color=\"#ff4444\", border_color=\"#ff0000\",\n", |
| 90 | + " value_color=\"#ffffff\", label_color=\"#ffcccc\"\n", |
| 91 | + ")\n", |
| 92 | + "\n", |
| 93 | + "ind_corp = mr.Indicator(\n", |
| 94 | + " value=\"$4.2M\", label=\"Q3 REVENUE\",\n", |
| 95 | + " background_color=\"#0f172a\", accent_color=\"#38bdf8\", border_color=\"#1e293b\",\n", |
| 96 | + " value_color=\"#f8fafc\", label_color=\"#94a3b8\"\n", |
| 97 | + ")\n", |
| 98 | + "\n", |
| 99 | + "ind_eco = mr.Indicator(\n", |
| 100 | + " value=\"94 AQI\", label=\"AIR QUALITY\",\n", |
| 101 | + " background_color=\"#f0fdf4\", accent_color=\"#22c55e\", border_color=\"#bbf7d0\",\n", |
| 102 | + " value_color=\"#166534\", label_color=\"#15803d\"\n", |
| 103 | + ")\n", |
| 104 | + "\n", |
| 105 | + "# Row 1 (3 items)\n", |
| 106 | + "mr.Indicator([ind_dark, ind_pastel, ind_alert])\n", |
| 107 | + "\n" |
| 108 | + ] |
| 109 | + }, |
| 110 | + { |
| 111 | + "cell_type": "code", |
| 112 | + "execution_count": null, |
| 113 | + "id": "38dfa2b1", |
| 114 | + "metadata": { |
| 115 | + "vscode": { |
| 116 | + "languageId": "plaintext" |
| 117 | + } |
| 118 | + }, |
| 119 | + "outputs": [], |
| 120 | + "source": [ |
| 121 | + "# Row 2 (2 items)\n", |
| 122 | + "mr.Indicator([ind_corp, ind_eco])" |
76 | 123 | ] |
77 | 124 | } |
78 | 125 | ], |
|
0 commit comments