mirror of
https://github.com/storytold/designcraft.git
synced 2026-11-01 06:06:49 -06:00
Swatches: a new document has InDesign's default swatches
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8dff7ecdb0
commit
31b95b83f2
@@ -348,6 +348,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
|
||||
|
||||
Newest first.
|
||||
|
||||
- **2026-10-20** · A new document's Swatches panel lists InDesign's defaults: [None], [Registration], [Paper], [Black] and six process colours (C=100, M=100, Y=100, C=15 M=100 Y=100, C=75 M=5 Y=100, C=100 M=90 Y=10); the extra M=100 Y=100, C=100 Y=100 and C=100 M=100 swatches are gone. No readiness percentage change.
|
||||
- **2026-10-16** · Type › Reload Fonts (`font.reload`): fonts installed, edited or removed while DesignCraft runs are read again without a restart, and the open documents recompose with them (#328, #547). An edited font file is noticed by its length and modification time; bundled, added and document fonts stay as they are. InDesign does this by itself, so noticing changes automatically is still open (gap 6). No readiness percentage change.
|
||||
- **2026-10-16** · Parents can be deleted from their Pages-panel context menu or `layout.parents.delete {id}`. Applied-page and based-on references are cleared, local override copies survive, and Undo restores the parent. Addresses the deletion portion of #956; no readiness percentage change.
|
||||
- **2026-10-17** · File › Package writes the document's and the IDML's links relative to the package (`Links/logo.png`, `file:Links/logo.png`), so a package holds no path from the machine that made it; opening a document resolves them to the files beside it. Links › Copy Link(s) To still links by full path. (#340). No readiness percentage change.
|
||||
|
||||
+27
-12
@@ -143,7 +143,9 @@ pub fn apply_tint(c: Color, tint: f32) -> Color {
|
||||
}
|
||||
}
|
||||
|
||||
/// A new document's swatches, in panel order.
|
||||
/// A new document's swatches, in panel order: InDesign's four specials, then its six process
|
||||
/// colours (cyan, magenta, yellow, red, green and blue as C=15 M=100 Y=100, C=75 M=5 Y=100 and
|
||||
/// C=100 M=90 Y=10).
|
||||
pub fn default_swatches() -> Vec<Swatch> {
|
||||
let special = |name: &str, value: SwatchValue| Swatch { name: name.into(), value, locked: true, named: true, hidden: false };
|
||||
let mut v = vec![
|
||||
@@ -152,17 +154,9 @@ pub fn default_swatches() -> Vec<Swatch> {
|
||||
special(PAPER, SwatchValue::Paper { color: Color::WHITE }),
|
||||
special(BLACK, SwatchValue::Color { color: Color::cmyk(0.0, 0.0, 0.0, 1.0), color_type: ColorType::Process }),
|
||||
];
|
||||
for (c, m, y, k) in [
|
||||
(1.0, 0.0, 0.0, 0.0),
|
||||
(0.0, 1.0, 0.0, 0.0),
|
||||
(0.0, 0.0, 1.0, 0.0),
|
||||
(0.0, 1.0, 1.0, 0.0),
|
||||
(1.0, 0.0, 1.0, 0.0),
|
||||
(1.0, 1.0, 0.0, 0.0),
|
||||
(0.15, 1.0, 1.0, 0.0),
|
||||
(0.75, 0.05, 1.0, 0.0),
|
||||
(1.0, 0.9, 0.1, 0.0),
|
||||
] {
|
||||
for (c, m, y, k) in
|
||||
[(1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.15, 1.0, 1.0, 0.0), (0.75, 0.05, 1.0, 0.0), (1.0, 0.9, 0.1, 0.0)]
|
||||
{
|
||||
v.push(Swatch::cmyk(c, m, y, k));
|
||||
}
|
||||
v
|
||||
@@ -181,6 +175,27 @@ mod tests {
|
||||
assert!(s.iter().any(|s| s.name == "C=100 M=0 Y=0 K=0"));
|
||||
}
|
||||
|
||||
/// The Swatches panel of a new InDesign document (Zero2Graphic's page layout tutorial, 3:22).
|
||||
#[test]
|
||||
fn defaults_are_indesigns_ten() {
|
||||
let names: Vec<String> = default_swatches().into_iter().map(|s| s.name).collect();
|
||||
assert_eq!(
|
||||
names,
|
||||
[
|
||||
"[None]",
|
||||
"[Registration]",
|
||||
"[Paper]",
|
||||
"[Black]",
|
||||
"C=100 M=0 Y=0 K=0",
|
||||
"C=0 M=100 Y=0 K=0",
|
||||
"C=0 M=0 Y=100 K=0",
|
||||
"C=15 M=100 Y=100 K=0",
|
||||
"C=75 M=5 Y=100 K=0",
|
||||
"C=100 M=90 Y=10 K=0",
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolves_tints_and_specials() {
|
||||
let mut s = default_swatches();
|
||||
|
||||
@@ -13,7 +13,7 @@ use designcraft_geom::{Affine, Rect, shapes};
|
||||
use designcraft_render::{RenderOptions, Renderer, color_of};
|
||||
use image::{ExtendedColorType, ImageEncoder};
|
||||
|
||||
const RED: &str = "C=0 M=100 Y=100 K=0";
|
||||
const RED: &str = "C=15 M=100 Y=100 K=0";
|
||||
const CYAN: &str = "C=100 M=0 Y=0 K=0";
|
||||
|
||||
fn encode(px: &[u8], w: u32, ct: ExtendedColorType, gif: bool) -> Vec<u8> {
|
||||
|
||||
Reference in New Issue
Block a user