Add set of evangelion themes/css palettes
This commit is contained in:
parent
b1014ff0cc
commit
6f64bd8e7f
3 changed files with 86 additions and 9 deletions
10
AGENTS.md
10
AGENTS.md
|
|
@ -109,7 +109,7 @@ eternalibre-notes/
|
|||
│ ├── notes.rs # Note model + file-system persistence
|
||||
│ ├── markdown.rs # Markdown → HTML with code block interception
|
||||
│ ├── syntax.rs # syntect engine + per-theme tmTheme generation
|
||||
│ ├── themes.rs # 40 predefined themes + CSS variable engine
|
||||
│ ├── themes.rs # 44 predefined themes + CSS variable engine
|
||||
│ ├── weather.rs # Opt-in wttr.in location/units, cached j1 lookup, forecast table data
|
||||
│ ├── quotes.rs # Local quote/author list stored as `.quotes.json`
|
||||
│ └── storage.rs # Storage re-export module
|
||||
|
|
@ -147,7 +147,7 @@ pub struct ANSIPalette {
|
|||
}
|
||||
```
|
||||
|
||||
`PREDEFINED_THEMES` contains 40 alphabetically ordered themes: Amber on Black, Autumn Forest, Blueberry on Black, Blueberry Professional, Breeze, Breeze Dark, Chartreuse on Black, Classic Windows 95, Claude, Cyan on Black, Cyberpunk 2077, Dark, Debian Professional, Dracula, Foggy Morning, Gentoo, Gentoo Professional, Golden Hour, Gruvbox Dark, Gruvbox Light, Light, Lilac Paper, Lime Green on Black, Monokai, Nord, One Dark, Orchid Noir, Platinum Desktop, Red on Black, Rose Quartz, Solarized Dark, Solarized Light, Stormy Night, Summer Sunset, Tokyo Night, Ubuntu Professional, Velvet Dusk, Vista Aero, Windows XP, and Winter Frost.
|
||||
`PREDEFINED_THEMES` contains 44 alphabetically ordered themes: Amber on Black, Autumn Forest, Blueberry on Black, Blueberry Professional, Breeze, Breeze Dark, Chartreuse on Black, Classic Windows 95, Claude, Cyan on Black, Cyberpunk 2077, Dark, Debian Professional, Dracula, Eva Unit-00 (Prototype), Eva Unit-00 (Rei), Eva Unit-01 (Shinji), Eva Unit-02 (Asuka), Foggy Morning, Gentoo, Gentoo Professional, Golden Hour, Gruvbox Dark, Gruvbox Light, Light, Lilac Paper, Lime Green on Black, Monokai, Nord, One Dark, Orchid Noir, Platinum Desktop, Red on Black, Rose Quartz, Solarized Dark, Solarized Light, Stormy Night, Summer Sunset, Tokyo Night, Ubuntu Professional, Velvet Dusk, Vista Aero, Windows XP, and Winter Frost.
|
||||
|
||||
The Gentoo palette is ported from Konsole: `Background` and `Foreground` supply `bg` and `fg`, `Color0`–`Color7` map to `ansi_normal`, and `Color0Intense`–`Color7Intense` map to `ansi_bright`. The Konsole `Faint` variants and terminal wallpaper/opacity options have no corresponding fields in `Theme` and are not represented.
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ Where no candidate clears the floor, the palette is at fault, not the code. **So
|
|||
|
||||
Comments also carry `fontStyle: italic` in the tmTheme, which syntect renders as `font-style:italic` on the span. Color alone is not a reliable signal, since a comment that falls back to the foreground is by definition the same color as the prose.
|
||||
|
||||
The three failure modes are each pinned by a test, and each test was verified to fail when the corresponding bug is reintroduced: `comments_are_readable_in_every_theme`, `no_theme_uses_its_background_for_comments`, and `comments_stay_distinct_from_the_foreground_when_they_can`. `syntax_color_always_picks_the_more_readable_variant` additionally pins the selection rule itself across all 40 themes and all 8 slots.
|
||||
The three failure modes are each pinned by a test, and each test was verified to fail when the corresponding bug is reintroduced: `comments_are_readable_in_every_theme`, `no_theme_uses_its_background_for_comments`, and `comments_stay_distinct_from_the_foreground_when_they_can`. `syntax_color_always_picks_the_more_readable_variant` additionally pins the selection rule itself across all 44 themes and all 8 slots.
|
||||
|
||||
### The Light theme has a data ceiling, not a logic bug
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ Non-visible `overflow` values (such as `auto` or `hidden`) create scroll/clip co
|
|||
|
||||
> **Do not reintroduce `overflow`, `transform`, `filter`, or `opacity` on `.menu-bar`, `.menu-list`, or `.menu-item`.** `overflow` on the dropdown *itself* is safe (it only clips its own contents), but on an ancestor it traps the dropdown.
|
||||
|
||||
The 40-entry Theme menu can exceed the viewport height, so its `.menu-dropdown` carries `max-height` plus `overflow-y: auto`. The short File dropdown is the exception: `.file-menu-dropdown` uses `overflow: visible` so the Export Note As flyout can escape to the right; scrolling is confined to the flyout itself. Keep overflow off the menu-bar ancestors.
|
||||
The 44-entry Theme menu can exceed the viewport height, so its `.menu-dropdown` carries `max-height` plus `overflow-y: auto`. The short File dropdown is the exception: `.file-menu-dropdown` uses `overflow: visible` so the Export Note As flyout can escape to the right; scrolling is confined to the flyout itself. Keep overflow off the menu-bar ancestors.
|
||||
|
||||
### Every screen needs a viewport meta, or the mobile CSS is dead
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ The trap is that the CSS is *correct and present*. You can add a complete mobile
|
|||
|
||||
**Its version and theme counts are derived, never typed.** The version comes from `env!("CARGO_PKG_VERSION")`, and the same macro drives the `.app-title` in the menu bar — which previously carried a hand-written version that had drifted from the manifest. The theme line is `PREDEFINED_THEMES.len()` split by `Theme::is_dark()`, so adding or removing a palette needs no edit here. Both are pinned by `about_page_reports_the_manifest_version` and `about_page_theme_counts_come_from_the_palette`.
|
||||
|
||||
`Theme::is_dark` classifies on the local gamma-encoded `relative_luminance` rather than the linearised one in `syntax.rs`. That is safe *only* because the shipped palettes are strongly bimodal: the lightest dark background scores 0.095 and the darkest light one 0.63, so any threshold in that gap agrees. If a future palette lands near 0.5, switch this to the WCAG function rather than nudging the threshold — the two agree on all 40 themes today, so the current answer is not a close call.
|
||||
`Theme::is_dark` classifies on the local gamma-encoded `relative_luminance` rather than the linearised one in `syntax.rs`. That is safe *only* because the shipped palettes are strongly bimodal: the lightest dark background scores 0.095 and the darkest light one 0.63, so any threshold in that gap agrees. If a future palette lands near 0.5, switch this to the WCAG function rather than nudging the threshold — the two agree on all 44 themes today, so the current answer is not a close call.
|
||||
|
||||
**Every outbound link carries `rel="noopener noreferrer"`.** `about_page_external_links_are_hardened` walks every `<a href="https://` in the rendered page, so a link added later without the attributes fails rather than shipping quietly. It caught the Help menu's GPL link, which had `target="_blank"` and no `rel`. Separately, users may opt into server-side wttr.in weather by saving a location; the request is cached and the configured location is sent to that service.
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ app from making that request.
|
|||
- **Move notes between folders** — drag a note onto a folder, use `File → Move to Folder…`, or the Move control in the editor on a phone
|
||||
- **One-row folder picker** — the sidebar shows the current folder; the folder list opens on demand and automatically while dragging, so it stays droppable however long the note list grows
|
||||
- **Per-note exports** — download Markdown or self-contained themed HTML, or print/save the themed note as PDF
|
||||
- **40 built-in themes** — including KDE Breeze, Blueberry Professional, classic desktop homages, distro-inspired palettes, warm neutrals, and more
|
||||
- **44 built-in themes** — including KDE Breeze, Blueberry Professional, Evangelion-inspired units, classic desktop homages, distro-inspired palettes, warm neutrals, and more
|
||||
- **Markdown extras** — tables, tasklists, strikethrough, and footnotes via `pulldown-cmark`
|
||||
- **Syntax highlighting** — code blocks are highlighted using the current theme's ANSI palette via `syntect`
|
||||
- **Mobile responsive** — collapses to a Notes/Write/Preview tab layout on phones, with 44px touch targets
|
||||
|
|
@ -242,7 +242,7 @@ cargo fmt
|
|||
| `src/notes.rs` | Note model and file-system persistence |
|
||||
| `src/markdown.rs` | Markdown to HTML with syntax highlighting |
|
||||
| `src/syntax.rs` | syntect integration and per-theme syntax color scheme generation |
|
||||
| `src/themes.rs` | 40 predefined themes and CSS variable engine |
|
||||
| `src/themes.rs` | 44 predefined themes and CSS variable engine |
|
||||
| `static/style.css` | Full application stylesheet |
|
||||
| `static/app.js` | Alpine.js component: preview, search, menus, tabs, drag-and-drop re-filing |
|
||||
| `eternalibre-notes.service` | systemd user-unit template for running the release binary |
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ impl Theme {
|
|||
/// any threshold in that gap returns the same answer. That margin is why
|
||||
/// this can use the local gamma-encoded `relative_luminance` rather than
|
||||
/// the linearised one in `syntax.rs` — for a binary split the two agree
|
||||
/// on all 40 themes, and adding a third implementation would cost more
|
||||
/// on all 44 themes, and adding a third implementation would cost more
|
||||
/// than the precision is worth.
|
||||
pub fn is_dark(&self) -> bool {
|
||||
relative_luminance(self.bg) < 0.5
|
||||
|
|
@ -258,6 +258,50 @@ pub static PREDEFINED_THEMES: &[Theme] = &[
|
|||
"#6272a4", "#ff6e6e", "#69ff94", "#ffffa5", "#d6acff", "#ff92df", "#a4ffff", "#ffffff",
|
||||
],
|
||||
},
|
||||
Theme {
|
||||
name: "Eva Unit-00 (Prototype)",
|
||||
fg: "#ffc24a",
|
||||
bg: "#2a1a05",
|
||||
ansi_normal: [
|
||||
"#1a1206", "#e35d3f", "#a3a83c", "#f0a500", "#6f8fb0", "#d98a6a", "#4fbfa8", "#ffd98a",
|
||||
],
|
||||
ansi_bright: [
|
||||
"#5c4520", "#ff7a55", "#d4d45a", "#ffc94d", "#9db8d8", "#f0a67a", "#7fe0cc", "#fff0c9",
|
||||
],
|
||||
},
|
||||
Theme {
|
||||
name: "Eva Unit-00 (Rei)",
|
||||
fg: "#b7dcff",
|
||||
bg: "#0a1526",
|
||||
ansi_normal: [
|
||||
"#0d1620", "#e35d6a", "#78c6a3", "#e8b04b", "#7aa2f7", "#b8a6d9", "#66d9e8", "#d6e9ff",
|
||||
],
|
||||
ansi_bright: [
|
||||
"#3d4f63", "#ff8a95", "#9de0bf", "#ffd27a", "#a8c7e8", "#d4c5f0", "#8ff0ff", "#f0f8ff",
|
||||
],
|
||||
},
|
||||
Theme {
|
||||
name: "Eva Unit-01 (Shinji)",
|
||||
fg: "#8aff5c",
|
||||
bg: "#241030",
|
||||
ansi_normal: [
|
||||
"#1a1024", "#e05252", "#4de86b", "#f2a33c", "#6d8bd8", "#a259ff", "#35e0d0", "#d7ffc2",
|
||||
],
|
||||
ansi_bright: [
|
||||
"#4a3b63", "#ff6b6b", "#8dff5a", "#ffc857", "#8fa8ff", "#c77dff", "#5ff2dc", "#efffe4",
|
||||
],
|
||||
},
|
||||
Theme {
|
||||
name: "Eva Unit-02 (Asuka)",
|
||||
fg: "#ff8c42",
|
||||
bg: "#350808",
|
||||
ansi_normal: [
|
||||
"#1a0b0b", "#ff5252", "#a3c34a", "#f28e2b", "#5b8dd6", "#e0559b", "#3fbfbf", "#ffd9b8",
|
||||
],
|
||||
ansi_bright: [
|
||||
"#5c2a2a", "#ff6b61", "#c4e06a", "#ffb85c", "#7fb0f0", "#ff7cb8", "#5fe0d8", "#ffe9d4",
|
||||
],
|
||||
},
|
||||
Theme {
|
||||
name: "Foggy Morning",
|
||||
fg: "#cfd8dc",
|
||||
|
|
@ -607,7 +651,7 @@ mod tests {
|
|||
"Sunny Day should have been deleted"
|
||||
);
|
||||
assert!(!PREDEFINED_THEMES.iter().any(|t| t.name == "Spring Blossom"));
|
||||
assert_eq!(PREDEFINED_THEMES.len(), 40);
|
||||
assert_eq!(PREDEFINED_THEMES.len(), 44);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -674,6 +718,39 @@ mod tests {
|
|||
assert_eq!(get_theme("Gentoo Professional").ansi_bright[4], "#a08bbc");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn evangelion_themes_port_the_supplied_palettes() {
|
||||
for (name, fg, bg) in [
|
||||
("Eva Unit-00 (Prototype)", "#ffc24a", "#2a1a05"),
|
||||
("Eva Unit-00 (Rei)", "#b7dcff", "#0a1526"),
|
||||
("Eva Unit-01 (Shinji)", "#8aff5c", "#241030"),
|
||||
("Eva Unit-02 (Asuka)", "#ff8c42", "#350808"),
|
||||
] {
|
||||
let theme = get_theme(name);
|
||||
assert_eq!(theme.name, name, "{name} should be in the catalogue");
|
||||
assert_eq!(theme.fg, fg, "{name} foreground");
|
||||
assert_eq!(theme.bg, bg, "{name} background");
|
||||
assert!(theme.is_dark(), "{name} should be a dark theme");
|
||||
}
|
||||
|
||||
// Pin a normal and bright slot per theme so a transcription slip in
|
||||
// the ANSI arrays fails rather than silently changing syntax colors.
|
||||
assert_eq!(
|
||||
get_theme("Eva Unit-00 (Prototype)").ansi_normal[1],
|
||||
"#e35d3f"
|
||||
);
|
||||
assert_eq!(
|
||||
get_theme("Eva Unit-00 (Prototype)").ansi_bright[6],
|
||||
"#7fe0cc"
|
||||
);
|
||||
assert_eq!(get_theme("Eva Unit-00 (Rei)").ansi_normal[4], "#7aa2f7");
|
||||
assert_eq!(get_theme("Eva Unit-00 (Rei)").ansi_bright[5], "#d4c5f0");
|
||||
assert_eq!(get_theme("Eva Unit-01 (Shinji)").ansi_normal[2], "#4de86b");
|
||||
assert_eq!(get_theme("Eva Unit-01 (Shinji)").ansi_bright[5], "#c77dff");
|
||||
assert_eq!(get_theme("Eva Unit-02 (Asuka)").ansi_normal[5], "#e0559b");
|
||||
assert_eq!(get_theme("Eva Unit-02 (Asuka)").ansi_bright[2], "#c4e06a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blueberry_professional_is_a_light_neutral_blueberry_variant() {
|
||||
let theme = get_theme("Blueberry Professional");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue