Merge PR #1417: Swatches: a new document has the reference app default swatches

This commit is contained in:
aiongg
2026-10-30 19:44:15 +00:00
3 changed files with 29 additions and 13 deletions
+1
View File
@@ -457,6 +457,7 @@ Newest first.
- **2026-10-16** · IDML: custom column positions are checked before they are used (#1096). A set must give two edges per column, ascending from the left margin to the right one; any other (a wrong count, unsorted or non-numeric values, a list longer than 216 columns allow, or positions left behind by a margin or page-size change) is the even split, in the canvas, on import and on export, instead of columns drawn outside the margins. No readiness percentage change.
- **2026-10-21** · Swatches panel rows show InDesign's columns, drawn in code: a crossed pencil on the swatches that can't be edited ([None], [Registration], [Black]), the colour type (process or spot) and the colour mode (CMYK, RGB, Gray, or [None]'s and [Registration]'s own glyphs), in place of a lock and "CMYK" text. Tint reads 100 with nothing selected. No readiness percentage change.
- **2026-10-21** · With a gradient fill or stroke, the Color panel shows the stop selected in the Gradient panel (the stop before a selected midpoint) with its values, and its C/M/Y/K or R/G/B sliders and spectrum colour that stop, keeping the others, as in InDesign. It showed "[None] — choose a colour on the ramp", and a spectrum click replaced the whole gradient with a flat colour. Found in the Learn Skills Daily course, chapter 24. No readiness percentage change.
- **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-21** · Properties › Character and Paragraph: ••• (More Options) expands the section in place, as InDesign's: Character adds vertical and horizontal scale, baseline shift, skew, language and OpenType, and All Caps, Small Caps, Superscript, Subscript, Underline and Strikethrough; Paragraph adds the left, right, first line and last line indents, space before and after, the drop cap's lines and characters, Align to Baseline Grid and Hyphenate. It used to open the Character or Paragraph panel; the language field moved under ••• as in InDesign. Found in the Learn Skills Daily course, chapter 16. No readiness percentage change.
- **2026-10-21** · The text Control panel has InDesign's two modes: A (Character Formatting Controls: font and style, size and leading, All Caps/Superscript/Underline and Small Caps/Subscript/Strikethrough, kerning and tracking, vertical and horizontal scale, baseline shift and skew, character style and language) and ¶ (Paragraph Formatting Controls: the nine alignments, left/first line and right/last line indents, space before and after, the drop cap's lines and characters, paragraph style, Hyphenate and Align to Baseline Grid). It used to show a fixed mix of both. Found in the Learn Skills Daily course, chapter 16. No readiness percentage change.
- **2026-10-20** · With the Type tool, the Control panel's font size, leading and tracking fields have a spinner and a list of common values, as in InDesign (auto leading in parentheses). No readiness percentage change.
+27 -12
View File
@@ -145,7 +145,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![
@@ -154,17 +156,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
@@ -188,6 +182,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();
+1 -1
View File
@@ -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> {