From f7355a98cfab087a72513c6be0120f53b6159954 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 18 Mar 2024 20:49:41 +0100 Subject: pieces --- tools/cylinders/face_austria_1.png | Bin 0 -> 2853 bytes tools/cylinders/face_austria_2.png | Bin 0 -> 2689 bytes tools/cylinders/face_austria_3.png | Bin 0 -> 3195 bytes tools/cylinders/face_austria_4.png | Bin 0 -> 2804 bytes tools/cylinders/face_austria_5.png | Bin 0 -> 3155 bytes tools/cylinders/face_austria_6.png | Bin 0 -> 3334 bytes tools/cylinders/face_bavaria_1.png | Bin 0 -> 2431 bytes tools/cylinders/face_france_1.png | Bin 0 -> 2264 bytes tools/cylinders/face_france_2.png | Bin 0 -> 2313 bytes tools/cylinders/face_france_3.png | Bin 0 -> 2189 bytes tools/cylinders/face_france_4.png | Bin 0 -> 2339 bytes tools/cylinders/face_france_5.png | Bin 0 -> 2553 bytes tools/cylinders/face_hussar.png | Bin 0 -> 4338 bytes tools/cylinders/face_pragmatic_1.png | Bin 0 -> 2416 bytes tools/cylinders/face_pragmatic_2.png | Bin 0 -> 3046 bytes tools/cylinders/face_pragmatic_3.png | Bin 0 -> 2725 bytes tools/cylinders/face_prussia_1.png | Bin 0 -> 3356 bytes tools/cylinders/face_prussia_2.png | Bin 0 -> 3295 bytes tools/cylinders/face_prussia_3.png | Bin 0 -> 3251 bytes tools/cylinders/face_prussia_4.png | Bin 0 -> 3321 bytes tools/cylinders/face_saxony_1.png | Bin 0 -> 2310 bytes tools/genpieces.mjs | 197 +++++++++++++++++++++++++++++++++++ 22 files changed, 197 insertions(+) create mode 100644 tools/cylinders/face_austria_1.png create mode 100644 tools/cylinders/face_austria_2.png create mode 100644 tools/cylinders/face_austria_3.png create mode 100644 tools/cylinders/face_austria_4.png create mode 100644 tools/cylinders/face_austria_5.png create mode 100644 tools/cylinders/face_austria_6.png create mode 100644 tools/cylinders/face_bavaria_1.png create mode 100644 tools/cylinders/face_france_1.png create mode 100644 tools/cylinders/face_france_2.png create mode 100644 tools/cylinders/face_france_3.png create mode 100644 tools/cylinders/face_france_4.png create mode 100644 tools/cylinders/face_france_5.png create mode 100644 tools/cylinders/face_hussar.png create mode 100644 tools/cylinders/face_pragmatic_1.png create mode 100644 tools/cylinders/face_pragmatic_2.png create mode 100644 tools/cylinders/face_pragmatic_3.png create mode 100644 tools/cylinders/face_prussia_1.png create mode 100644 tools/cylinders/face_prussia_2.png create mode 100644 tools/cylinders/face_prussia_3.png create mode 100644 tools/cylinders/face_prussia_4.png create mode 100644 tools/cylinders/face_saxony_1.png create mode 100644 tools/genpieces.mjs (limited to 'tools') diff --git a/tools/cylinders/face_austria_1.png b/tools/cylinders/face_austria_1.png new file mode 100644 index 0000000..5e0d8e8 Binary files /dev/null and b/tools/cylinders/face_austria_1.png differ diff --git a/tools/cylinders/face_austria_2.png b/tools/cylinders/face_austria_2.png new file mode 100644 index 0000000..e1962f7 Binary files /dev/null and b/tools/cylinders/face_austria_2.png differ diff --git a/tools/cylinders/face_austria_3.png b/tools/cylinders/face_austria_3.png new file mode 100644 index 0000000..347beb6 Binary files /dev/null and b/tools/cylinders/face_austria_3.png differ diff --git a/tools/cylinders/face_austria_4.png b/tools/cylinders/face_austria_4.png new file mode 100644 index 0000000..4f57939 Binary files /dev/null and b/tools/cylinders/face_austria_4.png differ diff --git a/tools/cylinders/face_austria_5.png b/tools/cylinders/face_austria_5.png new file mode 100644 index 0000000..6064767 Binary files /dev/null and b/tools/cylinders/face_austria_5.png differ diff --git a/tools/cylinders/face_austria_6.png b/tools/cylinders/face_austria_6.png new file mode 100644 index 0000000..05af263 Binary files /dev/null and b/tools/cylinders/face_austria_6.png differ diff --git a/tools/cylinders/face_bavaria_1.png b/tools/cylinders/face_bavaria_1.png new file mode 100644 index 0000000..2b9037c Binary files /dev/null and b/tools/cylinders/face_bavaria_1.png differ diff --git a/tools/cylinders/face_france_1.png b/tools/cylinders/face_france_1.png new file mode 100644 index 0000000..efae1b2 Binary files /dev/null and b/tools/cylinders/face_france_1.png differ diff --git a/tools/cylinders/face_france_2.png b/tools/cylinders/face_france_2.png new file mode 100644 index 0000000..4408f9b Binary files /dev/null and b/tools/cylinders/face_france_2.png differ diff --git a/tools/cylinders/face_france_3.png b/tools/cylinders/face_france_3.png new file mode 100644 index 0000000..72c8a32 Binary files /dev/null and b/tools/cylinders/face_france_3.png differ diff --git a/tools/cylinders/face_france_4.png b/tools/cylinders/face_france_4.png new file mode 100644 index 0000000..199e137 Binary files /dev/null and b/tools/cylinders/face_france_4.png differ diff --git a/tools/cylinders/face_france_5.png b/tools/cylinders/face_france_5.png new file mode 100644 index 0000000..d2f16b6 Binary files /dev/null and b/tools/cylinders/face_france_5.png differ diff --git a/tools/cylinders/face_hussar.png b/tools/cylinders/face_hussar.png new file mode 100644 index 0000000..6c57628 Binary files /dev/null and b/tools/cylinders/face_hussar.png differ diff --git a/tools/cylinders/face_pragmatic_1.png b/tools/cylinders/face_pragmatic_1.png new file mode 100644 index 0000000..7b83434 Binary files /dev/null and b/tools/cylinders/face_pragmatic_1.png differ diff --git a/tools/cylinders/face_pragmatic_2.png b/tools/cylinders/face_pragmatic_2.png new file mode 100644 index 0000000..6cf0aa9 Binary files /dev/null and b/tools/cylinders/face_pragmatic_2.png differ diff --git a/tools/cylinders/face_pragmatic_3.png b/tools/cylinders/face_pragmatic_3.png new file mode 100644 index 0000000..017db7b Binary files /dev/null and b/tools/cylinders/face_pragmatic_3.png differ diff --git a/tools/cylinders/face_prussia_1.png b/tools/cylinders/face_prussia_1.png new file mode 100644 index 0000000..c775664 Binary files /dev/null and b/tools/cylinders/face_prussia_1.png differ diff --git a/tools/cylinders/face_prussia_2.png b/tools/cylinders/face_prussia_2.png new file mode 100644 index 0000000..8273bd5 Binary files /dev/null and b/tools/cylinders/face_prussia_2.png differ diff --git a/tools/cylinders/face_prussia_3.png b/tools/cylinders/face_prussia_3.png new file mode 100644 index 0000000..d1f34d1 Binary files /dev/null and b/tools/cylinders/face_prussia_3.png differ diff --git a/tools/cylinders/face_prussia_4.png b/tools/cylinders/face_prussia_4.png new file mode 100644 index 0000000..3162c67 Binary files /dev/null and b/tools/cylinders/face_prussia_4.png differ diff --git a/tools/cylinders/face_saxony_1.png b/tools/cylinders/face_saxony_1.png new file mode 100644 index 0000000..ac97584 Binary files /dev/null and b/tools/cylinders/face_saxony_1.png differ diff --git a/tools/genpieces.mjs b/tools/genpieces.mjs new file mode 100644 index 0000000..cc75f03 --- /dev/null +++ b/tools/genpieces.mjs @@ -0,0 +1,197 @@ +import fs from "fs" +import { formatHex, parseHex, convertRgbToOklab } from 'culori' + +function make_piece_colors(base) { + let rgb = parseHex(base) + let sh1 = convertRgbToOklab(rgb); sh1.l *= 0.9; + let sh2 = convertRgbToOklab(rgb); sh2.l *= 0.8; + let sh3 = convertRgbToOklab(rgb); sh3.l *= 0.7; + let sh4 = convertRgbToOklab(rgb); sh4.l *= 0.4; + return [ base, formatHex(sh1), formatHex(sh2), formatHex(sh3), formatHex(sh4) ] +} + +const color_austria = make_piece_colors("#ffffff") +const color_bavaria = make_piece_colors("#ffc825") +const color_france = make_piece_colors("#ed1c24") +const color_pragmatic = make_piece_colors("#5f5c5c") +const color_prussia = make_piece_colors("#005988") +const color_saxony = make_piece_colors("#157d36") + +function print_cylinder(output, icon_file, c) { + let icon = fs.readFileSync(icon_file).toString('base64') + let svg = [] + svg.push('') + svg.push('') + + svg.push(``) + svg.push(``) + svg.push(``) + svg.push(``) + svg.push('') + + svg.push(``) + svg.push(``) + svg.push(``) + + svg.push('') + fs.writeFileSync(output, svg.join("\n") + "\n") +} + +function print_disc(output, icon_file, c) { + let icon = fs.readFileSync(icon_file).toString('base64') + let svg = [] + svg.push('') + svg.push('') + + svg.push(``) + svg.push(``) + svg.push(``) + svg.push(``) + svg.push('') + + svg.push(``) + svg.push(``) + svg.push(``) + + svg.push('') + fs.writeFileSync(output, svg.join("\n") + "\n") +} + +function print_cube(output, c) { + let svg = [] + + let xo = 0 + let yo = 0 + let ys = 2/3 + + let w = 20 + let d = Math.sqrt(w * w + w * w) + let h = Math.round(w * 0.8) + + let v = [ + [ xo + (d/2), yo + (0) * ys ], + [ xo + (d), yo + (d/2) * ys ], + [ xo + (d/2), yo + (d) * ys ], + [ xo + (0), yo + (d/2) * ys ], + ] + + for (let xy of v) { + xy[0] = Math.round(xy[0]) + 0.5 + xy[1] = Math.round(xy[1]) + 0.5 + } + + let v2 = [ + [ v[1][0], v[1][1] ], + [ v[1][0], v[1][1] + h ], + [ v[2][0], v[2][1] + h ], + [ v[3][0], v[3][1] + h ], + [ v[3][0], v[3][1] ], + ] + + let v3 = [ + [ v[2][0], v[2][1] ], + [ v[2][0], v[2][1] + h ], + ] + + let f1 = [ + [ v[1][0], v[1][1] ], + [ v[1][0], v[1][1] + h ], + [ v[2][0], v[2][1] + h ], + [ v[2][0], v[2][1] ], + ] + + let f2 = [ + [ v[2][0], v[2][1] ], + [ v[2][0], v[2][1] + h ], + [ v[3][0], v[3][1] + h ], + [ v[3][0], v[3][1] ], + ] + + svg.push('') + + svg.push(``) + svg.push(``) + svg.push(``) + + svg.push(``) + + svg.push('') + fs.writeFileSync(output, svg.join("\n") + "\n") +} + +print_cylinder("pieces/cylinder_austria_1.svg", "tools/cylinders.1x/face_austria_1.png", color_austria) +print_cylinder("pieces/cylinder_austria_2.svg", "tools/cylinders.1x/face_austria_2.png", color_austria) +print_cylinder("pieces/cylinder_austria_3.svg", "tools/cylinders.1x/face_austria_3.png", color_austria) +print_cylinder("pieces/cylinder_austria_4.svg", "tools/cylinders.1x/face_austria_4.png", color_austria) +print_cylinder("pieces/cylinder_austria_5.svg", "tools/cylinders.1x/face_austria_5.png", color_austria) +print_cylinder("pieces/cylinder_austria_6.svg", "tools/cylinders.1x/face_austria_6.png", color_austria) + +print_cylinder("pieces/cylinder_bavaria_1.svg", "tools/cylinders.1x/face_bavaria_1.png", color_bavaria) + +print_cylinder("pieces/cylinder_france_1.svg", "tools/cylinders.1x/face_france_1.png", color_france) +print_cylinder("pieces/cylinder_france_2.svg", "tools/cylinders.1x/face_france_2.png", color_france) +print_cylinder("pieces/cylinder_france_3.svg", "tools/cylinders.1x/face_france_3.png", color_france) +print_cylinder("pieces/cylinder_france_4.svg", "tools/cylinders.1x/face_france_4.png", color_france) +print_cylinder("pieces/cylinder_france_5.svg", "tools/cylinders.1x/face_france_5.png", color_france) + +print_cylinder("pieces/cylinder_pragmatic_1.svg", "tools/cylinders.1x/face_pragmatic_1.png", color_pragmatic) +print_cylinder("pieces/cylinder_pragmatic_2.svg", "tools/cylinders.1x/face_pragmatic_2.png", color_pragmatic) +print_cylinder("pieces/cylinder_pragmatic_3.svg", "tools/cylinders.1x/face_pragmatic_3.png", color_pragmatic) + +print_cylinder("pieces/cylinder_prussia_1.svg", "tools/cylinders.1x/face_prussia_1.png", color_prussia) +print_cylinder("pieces/cylinder_prussia_2.svg", "tools/cylinders.1x/face_prussia_2.png", color_prussia) +print_cylinder("pieces/cylinder_prussia_3.svg", "tools/cylinders.1x/face_prussia_3.png", color_prussia) +print_cylinder("pieces/cylinder_prussia_4.svg", "tools/cylinders.1x/face_prussia_4.png", color_prussia) + +print_cylinder("pieces/cylinder_saxony_1.svg", "tools/cylinders.1x/face_saxony_1.png", color_saxony) + +print_disc("pieces/disc_hussar.svg", "tools/cylinders.1x/face_hussar.png", color_austria) + +print_cube("pieces/cube_austria.svg", color_austria) +print_cube("pieces/cube_bavaria.svg", color_bavaria) +print_cube("pieces/cube_france.svg", color_france) +print_cube("pieces/cube_pragmatic.svg", color_pragmatic) +print_cube("pieces/cube_prussia.svg", color_prussia) +print_cube("pieces/cube_saxony.svg", color_saxony) + +let css = [ "/* TOKEN BORDER COLORS */" ] + +function border(base, sel) { + let rgb = parseHex(base) + // let hic = convertRgbToOklab(rgb); hic.l = Math.min(1,hic.l+0.1) + // let loc = convertRgbToOklab(rgb); loc.l = Math.max(0,loc.l-0.1) + // let shc = convertRgbToOklab(rgb); shc.l = Math.max(0,shc.l-0.4) + let hic = convertRgbToOklab(rgb); hic.l = Math.min(1,hic.l*1.2) + let loc = convertRgbToOklab(rgb); loc.l = Math.max(0,loc.l*0.8) + let shc = convertRgbToOklab(rgb); shc.l = Math.max(0,shc.l*0.4) + let sh = formatHex(shc) + let hi = formatHex(hic) + let lo = formatHex(loc) + css.push(`${sel} { background-color: ${base}; border-color: ${hi} ${lo} ${lo} ${hi}; box-shadow: 0 0 0 1px ${sh}, 0px 1px 4px #0008; }`) +} + +border("#006cb7", "#token_total_support") +border("#80643e", "#token_prop_card") +border("#d74729", "#token_oppose_plus_bases") +border("#004e81", "#token_el_presidente") +border("#6a8796", "#token_aid") +border("#01904b", ".token.shipment") +border("#4b87c0", ".token.passive_support") +border("#b75f61", ".token.passive_opposition") +border("#0054a6", ".token.active_support") +border("#991a1e", ".token.active_opposition") +border("#0054a6", ".token.govt_control") +border("#991a1e", ".token.farc_control") +border("#ffc509", ".token.farc_zone") +//border("#22010e", ".token.terror") +border("#535052", ".token.terror") +border("#535052", ".token.sabotage") +border("#9dadb3", ".token.unshaded") +border("#465c80", ".token.shaded") +border("#6d5735", ".token.reminder.sucumbios") +border("#cf1f30", ".token.reminder.senado_farc") +border("#6d9f3b", ".token.reminder.senado_cartels") +border("#ffcf00", ".token.reminder.senado_auc") +border("#8dc73f", ".token.reminder.darien") + +console.log(css.join("\n")) -- cgit v1.2.3