(482ff01) Grey unset Due and Owner in ls, and bump to 0.1.2

display_ticket_items printed both fields raw, so a ticket with no due date
showed _Not set_ in the default foreground. show already honoured the
guideline through colorize_metadata, leaving the listing as the one place
that ignored it. Reuses is_unknown_value rather than matching the markers
a second time.

Grey is indexed colour 8 in the 256-colour form. Two SGR spellings were
tried against a real terminal and both read as white: 90 leans on the
palette's bright-black slot, and 37 can sit right on top of the default
foreground. \x1b[38;5;8m is byte for byte what crossterm emits for
ratatui's Color::DarkGray, which is the grey frig and pantop already use
for dimmed rows, so this is the spelling known to render here. Pinned by a
test and written down in AGENTS.md, since only an eye in a real terminal
would catch it drifting back.

Patch bump covering the three colour tickets, 9991698, 934bf1a and this
one, as one body of work: nothing new, three places where output did not
do what the guideline said.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ansho Rei
2026-08-20 15:24:42 +02:00
co-authored by Claude Opus 5
parent 3abe8755c8
commit b7781a830c
4 changed files with 49 additions and 5 deletions
+3 -2
View File
@@ -33,7 +33,7 @@
### Color and Output
- Use `color_text()` helper for colored output — it respects `should_use_colors()` (terminal detection)
- Color codes are defined in `get_color()`: red (31), cyan (36), orange (33), green (32), grey (90)
- Color codes are defined in `get_color()`: red (31), cyan (36), orange (33), green (32), grey (38;5;8), magenta (1;35)
- Reset color with `\x1b[0m` after colored text
- Bold uses `\x1b[1;35m` (magenta bold)
- Always test color output works correctly in both terminal and pipe modes
@@ -43,7 +43,8 @@
- Status → orange (33)
- Timestamp → cyan (36)
- Title → green (32)
- Unknown values (`_None_`, `_Not set_`) → grey (90)
- Unknown values (`_None_`, `_Not set_`) → grey (38;5;8)
- Grey is indexed colour 8 in the 256-colour form, not SGR 90 or 37. Both of those failed on a real palette: 90 leans on the bright-black slot and 37 can sit on top of the default foreground. `\x1b[38;5;8m` is byte for byte what crossterm emits for ratatui's `Color::DarkGray`, the grey frig and pantop use for dimmed rows
### Code Organization
- Colorization functions (`colorize_line`, `colorize_metadata`, `colorize_ordered`, `content_trim_colored`) handle markdown formatting
Generated
+1 -1
View File
@@ -1029,7 +1029,7 @@ dependencies = [
[[package]]
name = "worklane"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"anyhow",
"assert_cmd",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "worklane"
version = "0.1.1"
version = "0.1.2"
edition = "2024"
[dependencies]
+44 -1
View File
@@ -58,7 +58,12 @@ pub fn get_color(color: &str) -> &'static str {
"cyan" => "\x1b[36m",
"orange" => "\x1b[33m",
"green" => "\x1b[32m",
"grey" => "\x1b[90m",
// Indexed colour 8 in the 256-colour form, which is byte for byte what
// crossterm emits for ratatui's Color::DarkGray, the grey frig and pantop
// use for dimmed rows. Neither SGR 90 nor 37 renders as grey on every
// palette: 90 leans on the bright-black slot and 37 can sit right on top
// of the default foreground.
"grey" => "\x1b[38;5;8m",
// Bold, per the guideline in AGENTS.md. Its absence meant colorize_line
// asked for a colour that did not exist and got an empty prefix.
"magenta" => "\x1b[1;35m",
@@ -493,9 +498,24 @@ pub fn status_dirs() -> Vec<&'static str> {
pub type TicketItem = (String, String, String, String, String);
/// Grey for a value that is not set, per the colour guideline.
///
/// `show` already did this through `colorize_metadata`, so the listing was the
/// one place that ignored the rule.
fn dim_if_unset(value: &str) -> String {
if is_unknown_value(value) {
color_text(value, "grey")
} else {
value.to_string()
}
}
pub fn display_ticket_items(items: &Vec<TicketItem>) {
for (title, owner, due, uuid, ts) in items {
let uuid_colored = color_text(uuid, "red");
let owner = dim_if_unset(owner);
let due = dim_if_unset(due);
if ts.is_empty() {
println!(
" ({}) {} | Owner: {} | Due: {}",
@@ -576,6 +596,20 @@ mod tests {
assert!(colors_wanted(true, None, None));
}
#[test]
fn unset_values_are_dimmed_and_set_ones_are_not() {
// Colour is off in a test process, so this asserts the decision, not the escape
for unset in ["_Not set_", "_None_"] {
assert!(is_unknown_value(unset), "{unset} should count as unset");
assert_eq!(dim_if_unset(unset), unset);
}
for set in ["alice", "2026-12-31", "bug,frontend"] {
assert!(!is_unknown_value(set));
assert_eq!(dim_if_unset(set), set);
}
}
#[test]
fn every_colour_the_code_asks_for_exists() {
for colour in ["red", "cyan", "orange", "green", "grey", "magenta"] {
@@ -583,6 +617,15 @@ mod tests {
}
}
/// Pinned deliberately. Both SGR spellings of grey failed on a real palette,
/// 90 reading nearly as light as the foreground and 37 sitting on top of it.
/// This is the exact sequence crossterm emits for ratatui's Color::DarkGray,
/// so worklane's grey is the one frig and pantop already render.
#[test]
fn grey_matches_the_indexed_colour_frig_uses() {
assert_eq!(get_color("grey"), "\x1b[38;5;8m");
}
/// With no colour to carry the emphasis, the markers are the emphasis.
#[test]
fn bold_markers_survive_when_colour_is_off() {