Group marks: a clear corner tab in every theme, fixed default colour, Any colour…

The mark recoloured each theme's corner art, which was thin and often
hard to see. Now it's a filled corner tab with a contrasting outline,
the same in every theme; collapsed groups show it too. Groups without a
colour are blue everywhere (was the theme's highlight gold). Colour menus
for cards, threads and groups end with a full colour picker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
RobinFiredrake 2026-11-14 13:55:46 -06:00
parent 83800c2f0e
commit b96fc02c0b
9 changed files with 82 additions and 39 deletions

View file

@ -25,8 +25,9 @@ var details: String = ""
var members: Array[String] = []
## The group this one sits inside ("" = on the spread itself).
var parent: String = ""
## "#rrggbb", or "" for the theme's group colour (Style.GROUP). Marks the
## frame's border and each member card's top-right corner.
## "#rrggbb", or "" for the default (GroupMark.DEFAULT_COLOR, the same in
## every theme). Marks the frame's border and each member card's top-right
## corner, and a collapsed group's own corner.
var color: String = ""

View file

@ -176,7 +176,9 @@ Result text can do more than plain words:
## Groups
- Drag a box on empty space to select several cards and groups (hold Ctrl or Shift to add to the selection), or Ctrl-click or Shift-click cards. Dragging any selected card or group moves them all.
- Press [b]Ctrl+G[/b] to put them in a group: a frame that moves and collapses as one.
- Drag cards into or out of a group. The group's ⋯ menu renames, saves as a template, ungroups or deletes it.
- Drag cards into or out of a group. The group's ⋯ menu renames, colours, saves as a template, ungroups or deletes it.
- Each card in a group has a small tab in its top-right corner in the group's colour, and a collapsed group shows the same tab. Groups without a colour are blue in every theme.
- To put whole groups inside a new group, select every card in them (or the collapsed group) along with the rest, then press Ctrl+G.
- [b]Spread ▾ → Pack collapsed groups[/b] moves collapsed groups together to close the gaps.
## Templates
@ -206,7 +208,7 @@ Groups can hold other groups. Select a group (drag a box around it) along with a
# Colours and themes
- [b]View ▾ → Theme…[/b] picks a theme and lets you change its colours, the background and panel gradients, the background pattern, the card border and the logo. Changes to a built-in theme are saved as a theme of your own.
- Give a card or a thread its own colour from its right-click menu ([b]Colour[/b]) or in the inspector, to sort things at a glance.
- Give a card, a thread or a group its own colour from its right-click menu ([b]Colour[/b]) or in the inspector, to sort things at a glance. [b]Any colour…[/b] at the end of the menu opens a full colour picker.
# List view
[b]List view[/b] (View ▾, ☰ or right-click the spread) shows every card as a plain list, for when you'd rather not use the spread.

View file

@ -20,7 +20,7 @@ func _init() -> void:
main.mark_dirty()
await _frames()
var mark := main.card_for("a").group_mark
_check(mark.visible and mark._color == Style.GROUP, "a member shows the theme's group mark")
_check(mark.visible and mark._color == GroupMark.DEFAULT_COLOR, "a member shows the default group mark (the same in every theme)")
_check(not main.card_for("c").group_mark.visible, "a card outside the group has no mark")
Actions.set_group_colour(main, g, "#3c8dd8")
@ -29,7 +29,7 @@ func _init() -> void:
_eq(TableGroup.from_dict(g.to_dict()).color, "#3c8dd8", "the group colour is saved")
main.undo_redo.undo()
await _frames()
_check(main.card_for("b").group_mark._color == Style.GROUP, "undo puts the theme colour back")
_check(main.card_for("b").group_mark._color == GroupMark.DEFAULT_COLOR, "undo puts the default colour back")
# Lying inside the frame isn't membership: no mark until it joins.
var c := main.card_for("c")
@ -44,4 +44,15 @@ func _init() -> void:
main.mark_dirty()
await _frames()
_check(not main.card_for("c").group_mark.visible, "leaving the group clears the mark")
_check(GroupMark.outline_for(Color.WHITE) != GroupMark.outline_for(Color.BLACK), "the tab's outline stands out from light and dark colours")
main.toggle_group(g.id)
await _frames()
var marks: Array = main.group_node(g.id).find_children("*", "GroupMark", true, false)
_check(marks.size() == 1 and (marks[0] as GroupMark).visible and (marks[0] as GroupMark)._color == GroupMark.color_of(g), "a collapsed group shows its own corner tab")
var menu := Actions.group(main, g)
var colour_menu: Dictionary = {}
for item: Dictionary in menu:
if str(item.get("text", "")) == "Colour":
colour_menu = item
_check((colour_menu.get("sub", []) as Array).any(func(item: Dictionary) -> bool: return str(item["text"]).ends_with("Any colour…")), "the group Colour menu ends with Any colour…")
finish()

View file

@ -66,11 +66,17 @@ static func popup_at(host: Control, list: Array, at: Vector2) -> PopupMenu:
return pm
## A "Colour ▸" submenu: Theme plus the ColorChoice presets.
static func colours(current: String, on_pick: Callable) -> Dictionary:
var sub: Array = [{"text": ("✓ " if current == "" else "") + "Theme colour", "do": on_pick.bind("")}]
## A "Colour ▸" submenu: the default (`default_label`), the ColorChoice
## presets and, with `m`, "Any colour…" (a full colour picker).
static func colours(current: String, on_pick: Callable, m: Main = null, default_label: String = "Theme colour") -> Dictionary:
var sub: Array = [{"text": ("✓ " if current == "" else "") + default_label, "do": on_pick.bind("")}]
var matched := current == ""
for p: Array in ColorChoice.PRESETS:
sub.append({"text": ("✓ " if current.to_lower() == str(p[1]) else "") + str(p[0]), "do": on_pick.bind(str(p[1]))})
var on := current.to_lower() == str(p[1])
matched = matched or on
sub.append({"text": ("✓ " if on else "") + str(p[0]), "do": on_pick.bind(str(p[1]))})
if m:
sub.append({"text": ("✓ " if not matched else "") + "Any colour…", "do": func() -> void: ColourDialog.open(m, current, on_pick)})
return {"text": "Colour", "tip": COLOUR_TIP, "sub": sub}
@ -91,7 +97,7 @@ static func card(m: Main, t: RollTable) -> Array:
if build:
list.append({"sep": ""})
list.append({"text": "Table settings…", "do": m.request_table_settings.bind(t.id)})
list.append(colours(t.color, func(hex: String) -> void: set_card_colour(m, t, hex)))
list.append(colours(t.color, func(hex: String) -> void: set_card_colour(m, t, hex), m))
list.append({"text": "Save as template…", "do": m.save_template_from.bind([t.id], "card")})
list.append({"sep": ""})
list.append({"text": "Delete table", "do": m.delete_table.bind(t.id)})
@ -137,7 +143,7 @@ static func thread(m: Main, key: String) -> Array:
e.pipe_color[to] = hex
m.mark_dirty()
m.board.geometry_rev += 1
m.undo_redo._end_edit()))
m.undo_redo._end_edit(), m))
list.append({"sep": ""})
list.append({"text": "Delete thread", "do": m.remove_pipe.bind(key)})
return list
@ -147,7 +153,7 @@ static func group(m: Main, g: TableGroup) -> Array:
var list: Array = [{"text": "Expand" if g.collapsed else "Collapse", "do": m.toggle_group.bind(g.id)}]
if m.mode == Main.Mode.BUILD:
list.append({"text": "Details…", "do": m.edit_group_details.bind(g.id)})
list.append(colours(g.color, func(hex: String) -> void: set_group_colour(m, g, hex)))
list.append(colours(g.color, func(hex: String) -> void: set_group_colour(m, g, hex), m, "Default (blue)"))
list.append({"text": "Save as template…", "do": m.save_template_from.bind([], "group", [g.id])})
list.append({"sep": ""})
list.append({"text": "Ungroup (keep the cards)", "do": m.ungroup.bind(g.id)})

19
ui/colour_dialog.gd Normal file
View file

@ -0,0 +1,19 @@
class_name ColourDialog
extends RefCounted
## "Any colour…" from a right-click Colour menu: a pop-up with a full colour
## picker (wheel, sliders and hex code). Choose calls `on_pick` with "#rrggbb".
static func open(main: Main, start: String, on_pick: Callable) -> ModalCard:
var dialog := ModalCard.new("Choose a colour", 360.0)
var picker := ColorPicker.new()
picker.edit_alpha = false
picker.color = Color.from_string(start, GroupMark.DEFAULT_COLOR)
picker.presets_visible = false
dialog.body.add_child(picker)
dialog.add_button("Cancel", "plain", dialog.close)
dialog.add_button("Choose", "primary", func() -> void:
dialog.close()
on_pick.call("#" + picker.color.to_html(false)))
main.add_child(dialog)
return dialog

1
ui/colour_dialog.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://3cajehoxahyr

View file

@ -24,6 +24,9 @@ static func build(card: GroupCard) -> void:
panel.accept_event()
)
card.add_child(panel)
var mark := GroupMark.new()
panel.add_child(mark)
mark.show_for(group)
var column := TableCard.vbox(0)
panel.add_child(column)

View file

@ -1,17 +1,20 @@
class_name GroupMark
extends Control
## The top-right corner of a card in a group, in the group's colour (its own,
## else Style.GROUP), so members are easy to tell from cards that only lie
## inside the group's frame. On a framed card it recolours that corner
## piece; on a plain card it draws a bracket over the corner.
## The top-right corner of a card in a group: a filled corner tab in the
## group's colour (its own, else DEFAULT_COLOR), with an outline that stands
## out from it, so members are easy to tell from cards that only lie inside
## the group's frame. The same tab, in the group's own colour, marks a
## collapsed group. It looks the same in every theme, so a theme change
## doesn't change how groups look.
##
## Like CardFrame it draws around the host card's whole rectangle, whatever box
## the container gives it.
## Like CardFrame it draws over the host's whole rectangle, whatever box the
## container gives it.
## Plain cards: how far the bracket runs along each edge, and its width.
const ARM := 26.0
const WIDTH := 4.0
const RADIUS := 10.0
## The colour of a group without a colour of its own, in every theme.
const DEFAULT_COLOR := Color("#3a7bd5")
## How far the tab runs along each edge, and its outline's width.
const SIZE := 22.0
const OUTLINE := 2.0
var _color := Color(0, 0, 0, 0)
@ -24,7 +27,13 @@ func _init() -> void:
## The colour of a group's mark and border.
static func color_of(g: TableGroup) -> Color:
return Color.from_string(g.color, Style.GROUP) if g.color != "" else Style.GROUP
return Color.from_string(g.color, DEFAULT_COLOR) if g.color != "" else DEFAULT_COLOR
## A colour that stands out against `fill`: near-black on light colours,
## white on dark ones.
static func outline_for(fill: Color) -> Color:
return Color(0.08, 0.06, 0.1) if fill.get_luminance() > 0.55 else Color(1, 1, 1, 0.95)
## Shows the mark for the card's group, or hides it (null).
@ -34,7 +43,6 @@ func show_for(g: TableGroup) -> void:
return
_color = c
visible = g != null
material = FrameSet.active.material_for(c) if g and FrameSet.active else null
queue_redraw()
@ -42,17 +50,10 @@ func _draw() -> void:
var host := get_parent() as Control
if host == null:
return
var fs := FrameSet.active
if fs:
var r := Rect2(-position, host.size).grow(fs.outset)
draw_set_transform(Vector2(r.end.x, r.position.y), 0.0, Vector2(-1, 1))
draw_texture_rect(fs.corner, Rect2(Vector2.ZERO, fs.corner_drawn()), false)
draw_set_transform(Vector2.ZERO)
return
# Plain: an L along the top and right edges, round where the card is.
var r := Rect2(-position, host.size)
var c := Vector2(r.end.x - RADIUS, r.position.y + RADIUS)
var inset := WIDTH / 2.0
draw_arc(c, RADIUS - inset, -PI / 2.0, 0.0, 12, _color, WIDTH, true)
draw_line(Vector2(r.end.x - ARM, r.position.y + inset), Vector2(c.x, r.position.y + inset), _color, WIDTH, true)
draw_line(Vector2(r.end.x - inset, c.y), Vector2(r.end.x - inset, r.position.y + ARM), _color, WIDTH, true)
var corner := Vector2(r.end.x, r.position.y)
var tab := PackedVector2Array([corner, corner + Vector2(-SIZE, 0), corner + Vector2(0, SIZE)])
draw_colored_polygon(tab, _color)
var edge := outline_for(_color)
draw_polyline(PackedVector2Array([corner + Vector2(-SIZE, 0), corner + Vector2(0, SIZE)]), edge, OUTLINE, true)
draw_polyline(PackedVector2Array([corner + Vector2(-SIZE, 0), corner, corner + Vector2(0, SIZE)]), edge, OUTLINE, true)

View file

@ -37,7 +37,6 @@ const TOKENS := [
["TRIM_DARK", "Trim, dark", false],
["THREAD_DARK", "Threads, dark edge", false],
["ACCENT_DARK", "Highlight, dark", false],
["GROUP", "Group mark (groups without a colour)", false],
["LIT", "Lit result", false],
["FLICK", "Rolling flicker", false],
["PULSE", "Thread pulse", false],