Skip to content

Commit 53549d0

Browse files
committed
feat: primary-colored square outline on active toggle buttons
- Add 'active' expression to each toolbar icon button in widgets.py - Buttons switch to variant='outlined' + color='primary' when on - CSS forces icon color to stay black via .tcmap-icon-black and .tcmap-editor-icon selectors (only border gets primary color) - border-radius: 4px gives square outline shape - Wavelet example toolbar buttons use same pattern
1 parent 0d63154 commit 53549d0

11 files changed

Lines changed: 36 additions & 14 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ The toolbar has three areas, left to right:
128128

129129
| # | Off | On | Toggle | Description |
130130
|---|-----|-----|--------|-------------|
131-
| 1 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/palette-outline.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/palette.svg" width="24"> | Category Filter | Shows/hides category checkboxes (Sequential, Multi-Sequential, Diverging, Cyclic) in the *Settings panel* to control which presets appear in the list. |
132-
| 2 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/blinds.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/blinds-open.svg" width="24"> | Colorblind Safe | Limits the *Preset list* to colorblind-safe presets only. Filters within the selected categories. |
133-
| 3 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/invert-colors-off.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/invert-colors.svg" width="24"> | Invert | Reverses the colormap direction (shown in the *Colorbar* and *Preset list*). |
134-
| 4a | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/stairs.svg" width="24"> | | Scale: Linear | Click to switch to Log scale. In diverging mode, switches to SymLog. |
135-
| 4b | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/math-log.svg" width="24"> | | Scale: Log | Click to switch to SymLog scale. **Note**: Not available in diverging mode. |
136-
| 4c | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/sine-wave.svg" width="24"> | | Scale: SymLog | Click to return to Linear scale. |
137-
| 5 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/triangle-outline.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/triangle.svg" width="24"> | Δ Difference | Enters diverging mode: forces diverging-only presets in *Preset list*, symmetric range around zero, and exposes \|max\| and ε controls in *Settings panel*. |
138-
| 6 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/pencil.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/arrow-expand-horizontal.svg" width="24"> | Custom Range | Toggles between data-driven range and manual Min/Max inputs exposed in the *Settings panel*. Locked (not shown in *Settings panel*)in diverging mode. |
139-
| 7 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/gradient-horizontal.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/view-sequential.svg" width="24"> | Discrete | Switches between continuous gradient and discrete color banding. Exposes "Colors per tick interval" (Linear) or "Colors per magnitude" (Log/SymLog) control in *Settings panel*. |
131+
| 1 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/palette-outline.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/palette.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | Category Filter | Shows/hides category checkboxes (Sequential, Multi-Sequential, Diverging, Cyclic) in the *Settings panel* to control which presets appear in the list. |
132+
| 2 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/blinds.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/blinds-open.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | Colorblind Safe | Limits the *Preset list* to colorblind-safe presets only. Filters within the selected categories. |
133+
| 3 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/invert-colors-off.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/invert-colors.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | Invert | Reverses the colormap direction (shown in the *Colorbar* and *Preset list*). |
134+
| 4a | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/stairs.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | | Scale: Linear | Click to switch to Log scale. In diverging mode, switches to SymLog. |
135+
| 4b | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/math-log.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | | Scale: Log | Click to switch to SymLog scale. **Note**: Not available in diverging mode. |
136+
| 4c | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/sine-wave.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | | Scale: SymLog | Click to return to Linear scale. |
137+
| 5 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/triangle-outline.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/triangle.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | Δ Difference | Enters diverging mode: forces diverging-only presets in *Preset list*, symmetric range around zero, and exposes \|max\| and ε controls in *Settings panel*. |
138+
| 6 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/pencil.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/arrow-expand-horizontal.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | Custom Range | Toggles between data-driven range and manual Min/Max inputs exposed in the *Settings panel*. Locked (not shown in *Settings panel*)in diverging mode. |
139+
| 7 | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/gradient-horizontal.svg" width="24"> | <img src="https://cdn.jsdelivr.net/npm/@mdi/svg/svg/view-sequential.svg" width="24" style="border: 2px solid #1867C0; border-radius: 4px; padding: 2px;"> | Discrete | Switches between continuous gradient and discrete color banding. Exposes "Colors per tick interval" (Linear) or "Colors per magnitude" (Log/SymLog) control in *Settings panel*. |
140140

141141
#### Scale Modes
142142

-31.2 KB
Loading
-30 KB
Loading

docs/images/clicked-linear.png

-36.9 KB
Loading

docs/images/clicked-log.png

-37.3 KB
Loading

docs/images/clicked-symlog.png

-34.2 KB
Loading

docs/images/normal.png

-24.2 KB
Loading

docs/images/panelbar.png

-2.19 KB
Loading

examples/wavelet.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,33 @@ def _build_ui(self):
235235
icon="mdi-arrow-up-bold",
236236
click="show_up = !show_up",
237237
density="compact",
238-
variant=("show_up ? 'flat' : 'outlined'",),
238+
variant=("show_up ? 'outlined' : 'text'",),
239+
color=("show_up ? 'primary' : undefined",),
240+
classes="rounded tcmap-icon-black",
239241
)
240242
v3.VBtn(
241243
icon="mdi-arrow-down-bold",
242244
click="show_down = !show_down",
243245
density="compact",
244-
variant=("show_down ? 'flat' : 'outlined'",),
246+
variant=("show_down ? 'outlined' : 'text'",),
247+
color=("show_down ? 'primary' : undefined",),
248+
classes="rounded tcmap-icon-black",
245249
)
246250
v3.VBtn(
247251
icon="mdi-arrow-left-bold",
248252
click="show_left = !show_left",
249253
density="compact",
250-
variant=("show_left ? 'flat' : 'outlined'",),
254+
variant=("show_left ? 'outlined' : 'text'",),
255+
color=("show_left ? 'primary' : undefined",),
256+
classes="rounded tcmap-icon-black",
251257
)
252258
v3.VBtn(
253259
icon="mdi-arrow-right-bold",
254260
click="show_right = !show_right",
255261
density="compact",
256-
variant=("show_right ? 'flat' : 'outlined'",),
262+
variant=("show_right ? 'outlined' : 'text'",),
263+
color=("show_right ? 'primary' : undefined",),
264+
classes="rounded tcmap-icon-black",
257265
)
258266
v3.VBtn(
259267
icon="mdi-crop-free",

src/trame_colormaps/module/serve/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
width: 24px !important;
1313
height: 24px !important;
1414
padding: 0;
15+
border-radius: 4px !important;
16+
}
17+
18+
.tcmap-editor-icon.v-btn--variant-outlined .v-icon,
19+
.tcmap-icon-black.v-btn--variant-outlined .v-icon {
20+
color: rgba(0, 0, 0, 0.87) !important;
1521
}
1622

1723
.tcmap-editor-search {

0 commit comments

Comments
 (0)