// One knight, four teams. Only the cloth ramps swap. Steel, gold and // leather keep their pixels, the way console games did palette swaps. let cape = ["#3A0E2B", "#5A1236", "#A51D45", "#E02948", "#FF5B3E"]; let tabard = ["#14193F", "#1B2A6E", "#2C3F8F", "#3F5FC0"]; // A shading ramp from one hue: shadows drift cool, highlights warm. fn ramp(hue, n) { let out = []; for i in 0..n { let t = i.to_float() / (n - 1).to_float(); let h = (hue + 330.0 + 40.0 * t) % 360.0; out.push(color_from_hsl(h, 50.0 + 35.0 * t, 14.0 + 58.0 * t)); } out } // name, cape hue, tabard hue. let teams = [["moss", 105.0, 35.0], ["frost", 190.0, 265.0], ["ember", 30.0, 345.0]]; // The sheet is 2x2. Cell 0 keeps the original colors. let cw = ps.doc_width() / 2; let ch = ps.doc_height() / 2; for t in 0..teams.len() { let team = teams[t]; let swap = #{}; let a = ramp(team[1], 5); let b = ramp(team[2], 4); for i in 0..5 { swap[cape[i]] = a[i]; } for i in 0..4 { swap[tabard[i]] = b[i]; } let x0 = (t + 1) % 2 * cw; let y0 = (t + 1) / 2 * ch; let n = 0; for y in y0..y0 + ch { for x in x0..x0 + cw { let c = ps.pixel_get(x, y); if c in swap { ps.pixel_set(x, y, swap[c]); n += 1; } } } print(`${team[0]}: ${n} px swapped`); } // A bone outline around the whole sheet, ready for a sticker export. ps_filter_outline(1, "#E8E9F2");