more on themes

This commit is contained in:
Hermes Agent
2026-08-16 20:51:14 +00:00
parent 7c0f5a2e0a
commit e407c064bf
5 changed files with 28 additions and 53 deletions

View File

@@ -80,9 +80,9 @@ Research URLs:
`~/.config/rogue-agenda/preferences.toml`: theme, command bar, rule/return/item `~/.config/rogue-agenda/preferences.toml`: theme, command bar, rule/return/item
markers, autosave, confirmations, date/time display, and number separators; markers, autosave, confirmations, date/time display, and number separators;
predefined values use Space-open keyboard/mouse choice popovers. predefined values use Space-open keyboard/mouse choice popovers.
- [x] Seven bundled palettes: Lotus-inspired Classic, Mono, Amber, Nord, - [x] Six bundled palettes: Lotus-inspired Classic, Mono, Amber, Greenscreen,
Solarized Dark, Solarized Light, and Catppuccin Mocha. The four modern themes Nord, and Catppuccin Mocha. The three additional themes enforce at least 7:1
enforce at least 7:1 selected-row contrast without changing the original three. selected-row contrast without changing the original three.
- [x] Dedicated, contrast-checked canvas-heading colors across all themes for - [x] Dedicated, contrast-checked canvas-heading colors across all themes for
column titles, sections, Datebook dates, aggregates, and empty-view messages. column titles, sections, Datebook dates, aggregates, and empty-view messages.
- [x] Transactional per-document settings embedded in `.agnd`: description, - [x] Transactional per-document settings embedded in `.agnd`: description,

View File

@@ -116,18 +116,18 @@ bottom command strip.
Press `F10`, then `p` for application-wide Preferences. Rogue Agenda saves these Press `F10`, then `p` for application-wide Preferences. Rogue Agenda saves these
as typed TOML at `~/.config/rogue-agenda/preferences.toml`. The screen controls: as typed TOML at `~/.config/rogue-agenda/preferences.toml`. The screen controls:
- `classic`, `mono`, `amber`, `nord`, `solarized-dark`, `solarized-light`, and - `classic`, `mono`, `amber`, `greenscreen`, `nord`, and `catppuccin-mocha`
`catppuccin-mocha` themes themes
- function-key command bar and category-rule detail visibility - function-key command bar and category-rule detail visibility
- carriage-return and item markers - carriage-return and item markers
- autosave checkpoint interval and destructive-action confirmations - autosave checkpoint interval and destructive-action confirmations
- ISO, US, European, or long date display and 12/24-hour time - ISO, US, European, or long date display and 12/24-hour time
- decimal and thousands separators - decimal and thousands separators
Nord, both Solarized variants, and Catppuccin Mocha use dedicated selected-row Greenscreen, Nord, and Catppuccin Mocha use dedicated selected-row
foreground/background pairs with at least 7:1 relative-luminance contrast. Every foreground/background pairs with at least 7:1 relative-luminance contrast.
theme also defines a contrast-checked canvas-heading color for column titles, Every theme also defines a contrast-checked canvas-heading color for column
sections, dates, aggregate rows, and empty-view messages. titles, sections, dates, aggregate rows, and empty-view messages.
The file is created when Preferences are first saved. It can also be edited with The file is created when Preferences are first saved. It can also be edited with
a text editor while Rogue Agenda is closed; unknown keys and invalid values are a text editor while Rogue Agenda is closed; unknown keys and invalid values are

View File

@@ -1183,9 +1183,8 @@ pub(crate) fn form_choices(kind: &FormKind, field: usize) -> Option<Vec<ChoiceOp
("Classic — Lotus-inspired blue", "classic"), ("Classic — Lotus-inspired blue", "classic"),
("Mono — grayscale", "mono"), ("Mono — grayscale", "mono"),
("Amber — warm dark", "amber"), ("Amber — warm dark", "amber"),
("Greenscreen — muted phosphor green", "greenscreen"),
("Nord — arctic blue dark", "nord"), ("Nord — arctic blue dark", "nord"),
("Solarized Dark — balanced low contrast", "solarized-dark"),
("Solarized Light — warm paper light", "solarized-light"),
("Catppuccin Mocha — cozy pastel dark", "catppuccin-mocha"), ("Catppuccin Mocha — cozy pastel dark", "catppuccin-mocha"),
], ],
1..=3 | 6 | 8 => YES_NO_CHOICES, 1..=3 | 6 | 8 => YES_NO_CHOICES,

View File

@@ -90,17 +90,11 @@ impl AppPreferences {
pub fn validate(&self) -> Result<()> { pub fn validate(&self) -> Result<()> {
if !matches!( if !matches!(
self.theme.as_str(), self.theme.as_str(),
"classic" "classic" | "mono" | "amber" | "greenscreen" | "nord" | "catppuccin-mocha"
| "mono"
| "amber"
| "nord"
| "solarized-dark"
| "solarized-light"
| "catppuccin-mocha"
) { ) {
bail!( bail!(
"theme must be classic, mono, amber, nord, solarized-dark, \ "theme must be classic, mono, amber, greenscreen, nord, or \
solarized-light, or catppuccin-mocha" catppuccin-mocha"
) )
} }
if !matches!( if !matches!(
@@ -170,9 +164,8 @@ mod tests {
"classic", "classic",
"mono", "mono",
"amber", "amber",
"greenscreen",
"nord", "nord",
"solarized-dark",
"solarized-light",
"catppuccin-mocha", "catppuccin-mocha",
] { ] {
let preferences = AppPreferences { let preferences = AppPreferences {

View File

@@ -47,6 +47,15 @@ fn palette(theme: &str) -> Palette {
selection_foreground: rgb(0xffffff), selection_foreground: rgb(0xffffff),
foreground: Color::Rgb(255, 191, 0), foreground: Color::Rgb(255, 191, 0),
}, },
"greenscreen" => Palette {
primary: Color::Black,
accent: rgb(0x79a86b),
canvas: rgb(0x030704),
canvas_heading: rgb(0x9ac58d),
selection: rgb(0x284b2f),
selection_foreground: rgb(0xdce8d8),
foreground: rgb(0x8fbd80),
},
"nord" => Palette { "nord" => Palette {
primary: rgb(0x2e3440), primary: rgb(0x2e3440),
accent: rgb(0x88c0d0), accent: rgb(0x88c0d0),
@@ -56,24 +65,6 @@ fn palette(theme: &str) -> Palette {
selection_foreground: rgb(0x2e3440), selection_foreground: rgb(0x2e3440),
foreground: rgb(0xeceff4), foreground: rgb(0xeceff4),
}, },
"solarized-dark" => Palette {
primary: rgb(0x002b36),
accent: rgb(0x2aa198),
canvas: rgb(0x073642),
canvas_heading: rgb(0xfdf6e3),
selection: rgb(0xfdf6e3),
selection_foreground: rgb(0x002b36),
foreground: rgb(0x839496),
},
"solarized-light" => Palette {
primary: rgb(0x586e75),
accent: rgb(0xeee8d5),
canvas: rgb(0xfdf6e3),
canvas_heading: rgb(0x002b36),
selection: rgb(0x002b36),
selection_foreground: rgb(0xfdf6e3),
foreground: rgb(0x657b83),
},
"catppuccin-mocha" => Palette { "catppuccin-mocha" => Palette {
primary: rgb(0x181825), primary: rgb(0x181825),
accent: rgb(0xcba6f7), accent: rgb(0xcba6f7),
@@ -1433,9 +1424,8 @@ mod tests {
.collect::<String>(); .collect::<String>();
assert!(screen.contains("Classic — Lotus-inspired blue")); assert!(screen.contains("Classic — Lotus-inspired blue"));
assert!(screen.contains("Amber — warm dark")); assert!(screen.contains("Amber — warm dark"));
assert!(screen.contains("Greenscreen — muted phosphor green"));
assert!(screen.contains("Nord — arctic blue dark")); assert!(screen.contains("Nord — arctic blue dark"));
assert!(screen.contains("Solarized Dark — balanced low contrast"));
assert!(screen.contains("Solarized Light — warm paper light"));
assert!(screen.contains("Catppuccin Mocha — cozy pastel dark")); assert!(screen.contains("Catppuccin Mocha — cozy pastel dark"));
app.handle_key(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE)) app.handle_key(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE))
@@ -1463,9 +1453,8 @@ mod tests {
}; };
assert_eq!(form.values[0], "amber"); assert_eq!(form.values[0], "amber");
assert_eq!(palette("greenscreen").foreground, Color::Rgb(143, 189, 128));
assert_eq!(palette("nord").primary, Color::Rgb(46, 52, 64)); assert_eq!(palette("nord").primary, Color::Rgb(46, 52, 64));
assert_eq!(palette("solarized-dark").canvas, Color::Rgb(7, 54, 66));
assert_eq!(palette("solarized-light").canvas, Color::Rgb(253, 246, 227));
assert_eq!( assert_eq!(
palette("catppuccin-mocha").foreground, palette("catppuccin-mocha").foreground,
Color::Rgb(205, 214, 244) Color::Rgb(205, 214, 244)
@@ -1482,13 +1471,8 @@ mod tests {
} }
#[test] #[test]
fn added_themes_keep_selected_rows_at_high_contrast() { fn additional_themes_keep_selected_rows_at_high_contrast() {
for theme in [ for theme in ["greenscreen", "nord", "catppuccin-mocha"] {
"nord",
"solarized-dark",
"solarized-light",
"catppuccin-mocha",
] {
let colors = palette(theme); let colors = palette(theme);
let ratio = contrast_ratio(colors.selection_foreground, colors.selection); let ratio = contrast_ratio(colors.selection_foreground, colors.selection);
assert!( assert!(
@@ -1504,9 +1488,8 @@ mod tests {
"classic", "classic",
"mono", "mono",
"amber", "amber",
"greenscreen",
"nord", "nord",
"solarized-dark",
"solarized-light",
"catppuccin-mocha", "catppuccin-mocha",
] { ] {
let colors = palette(theme); let colors = palette(theme);