commit 3549dea8464bc6419fd48cb687cb21bc7e5ff6af Author: Kazhnuz Date: Sun Feb 2 19:42:18 2025 +0100 🎉 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..86f0ff8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +output +node_modules +package-lock.json \ No newline at end of file diff --git a/NFPixels-Regular.ttf b/NFPixels-Regular.ttf new file mode 100644 index 0000000..cd4c2cf Binary files /dev/null and b/NFPixels-Regular.ttf differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..999380a --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# Pride Buttons + +Juste des boutons 88x31 de pride, généré avec l'aide de fond et de textes (présent dans data.json) + +## Lancer le générateur + +( Instruction pour bluefin, qui utilise homebrew pour ses outils en ligne de commande ) + +```shell +brew install imagemagick +brew install graphicsmagick +npm i +npm run build +``` \ No newline at end of file diff --git a/data.json b/data.json new file mode 100644 index 0000000..65ec7e1 --- /dev/null +++ b/data.json @@ -0,0 +1,67 @@ +[ + { + "source": "./sources/pride.gif", + "name": {"en":"Pride", "fr":"Pride"}, + "texts": ["LGBTQ+", "proud", "fier⋅e", "fier", "fière", "queer"] + }, + { + "source": "./sources/ace.gif", + "name": {"en":"Asexual", "fr":"Asexuel"}, + "texts": ["ace", "asexual", "asexuel", "asexuelle", "asexuel⋅le"] + }, + { + "source": "./sources/agender.gif", + "name": {"en":"Agender", "fr":"Agenre"}, + "texts": ["agender", "agenre"] + }, + { + "source": "./sources/aromantic.gif", + "name": {"en":"Aromantic", "fr":"Aromantique"}, + "texts": ["aromantic", "aromantique", "aro"] + }, + { + "source": "./sources/bisexual.gif", + "name": {"en":"Bisexual", "fr":"Bisexuel"}, + "texts": ["bisexual", "bisexuel", "bisexuelle", "bisexuel⋅le", "bi"] + }, + { + "source": "./sources/demiboy.gif", + "name": {"en":"Demiboy", "fr":"Demigars"}, + "texts": ["demiboy", "demiman", "demigars", "demihomme", "demimec"] + }, + { + "source": "./sources/demigirl.gif", + "name": {"en":"Demigirl", "fr":"Demifille"}, + "texts": ["demigirl", "demiwoman", "demifemme", "demifille", "demimeuf"] + }, + { + "source": "./sources/gay.gif", + "name": {"en":"Gay", "fr":"Gay"}, + "texts": ["gay", "homosexuel", "homosexuel⋅le"] + }, + { + "source": "./sources/intersex-1.gif", + "name": {"en":"Intersex", "fr":"Intersexué"}, + "texts": ["Intersex", "Intersexué", "Intersexuée", "Intersexué⋅e"] + }, + { + "source": "./sources/lesbian.gif", + "name": {"en":"Lesbian", "fr":"Lesbienne"}, + "texts": ["lesbienne", "lesbian", "homosexuelle", "homosexuel⋅le"] + }, + { + "source": "./sources/nonbinary.gif", + "name": {"en":"Non-Binary", "fr":"Non-binaire"}, + "texts": ["non-binary", "non-binaire", "enby", "nb"] + }, + { + "source": "./sources/pansexual.gif", + "name": {"en":"Pansexual", "fr":"Pansexuel"}, + "texts": ["pansexual", "pan", "pansexuel", "pansexuelle", "pansexuel⋅le"] + }, + { + "source": "./sources/trans.gif", + "name": {"en":"Transgender", "fr":"Transgenre"}, + "texts": ["transgender", "transgenre", "trans", "fuck\ntransphobes", "trans\nrights", "fuck\nterfs", "no to\nterfs", "Non aux\nterfs", "stop\ntransphobia", "stop à la\ntransphobie", "protect\ntrans kids", "droits\ntrans"] + } +] \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..d13538f --- /dev/null +++ b/main.js @@ -0,0 +1,51 @@ +import data from './data.json' with { type: "json" }; +import gm from "gm"; +import * as fs from "fs"; + + +const myGm = gm.subClass({imageMagick: true}); + +const position = {x: 4, y: 2, gravity: "NorthEast"} +const metadatas = [] + +data.forEach(prideflag => { + console.log(`== Creating flags for ${prideflag.name.en}`); + const imageMetadata = {title:`Drapeau ${prideflag.name.fr.toLowerCase()} :`, list:[]}; + prideflag.texts.forEach(text => { + const outputfile = `${prideflag.name.en.toLowerCase()}-${text.replace("⋅", "_").replace(" ", "_").replace("\n", '-').toLowerCase()}.png` + console.log(`Creating button for text ${text} (${outputfile})`); + const data = {file: outputfile, alt:`Drapeau ${prideflag.name.fr.toLowerCase()} avec écrit "${text.replace("\n", " ").toLowerCase()}"`}; + imageMetadata.list.push(data); + const turnedText = text + .replace("⋅", "-") + .toUpperCase(); + myGm(prideflag.source) + .font('./NFPixels-Regular.ttf', 10) + .drawText(position.x-1, position.y, turnedText, position.gravity) + .drawText(position.x+1, position.y, turnedText, position.gravity) + .drawText(position.x, position.y+1, turnedText, position.gravity) + .drawText(position.x, position.y-1, turnedText, position.gravity) + .drawText(position.x-1, position.y-1, turnedText, position.gravity) + .drawText(position.x+1, position.y+1, turnedText, position.gravity) + .drawText(position.x-1, position.y+1, turnedText, position.gravity) + .drawText(position.x+1, position.y-1, turnedText, position.gravity) + .fill("#FFFFFF") + .drawText(position.x, position.y, turnedText, position.gravity) + .write(`./output/${outputfile}`, function (err) { + if (err) { + console.error(err); + throw err; + }; + }); + }) + metadatas.push(imageMetadata); +}); + +console.log(metadatas); + +fs.writeFile("./output/pridebuttons.json", JSON.stringify(metadatas), (err) => { + if (err) { + console.error(err); + throw err; + } +}); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..767fb88 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "pride-button", + "version": "1.0.0", + "description": "A set of pride buttons", + "scripts": { + "build": "node main.js" + }, + "dependencies": { + "gm": "^1.25.0" + } +} diff --git a/sources/ace.gif b/sources/ace.gif new file mode 100644 index 0000000..0585902 Binary files /dev/null and b/sources/ace.gif differ diff --git a/sources/agender.gif b/sources/agender.gif new file mode 100644 index 0000000..861f575 Binary files /dev/null and b/sources/agender.gif differ diff --git a/sources/aromantic.gif b/sources/aromantic.gif new file mode 100644 index 0000000..13f9e07 Binary files /dev/null and b/sources/aromantic.gif differ diff --git a/sources/bisexual.gif b/sources/bisexual.gif new file mode 100644 index 0000000..50c2ea1 Binary files /dev/null and b/sources/bisexual.gif differ diff --git a/sources/demiboy.gif b/sources/demiboy.gif new file mode 100644 index 0000000..94b983b Binary files /dev/null and b/sources/demiboy.gif differ diff --git a/sources/demigirl.gif b/sources/demigirl.gif new file mode 100644 index 0000000..715844e Binary files /dev/null and b/sources/demigirl.gif differ diff --git a/sources/demiromantic.gif b/sources/demiromantic.gif new file mode 100644 index 0000000..703850e Binary files /dev/null and b/sources/demiromantic.gif differ diff --git a/sources/demisexual.gif b/sources/demisexual.gif new file mode 100644 index 0000000..fccc04f Binary files /dev/null and b/sources/demisexual.gif differ diff --git a/sources/gay.gif b/sources/gay.gif new file mode 100644 index 0000000..b4c7665 Binary files /dev/null and b/sources/gay.gif differ diff --git a/sources/intersex-1.gif b/sources/intersex-1.gif new file mode 100644 index 0000000..6be5c3d Binary files /dev/null and b/sources/intersex-1.gif differ diff --git a/sources/intersex-2.gif b/sources/intersex-2.gif new file mode 100644 index 0000000..16a109f Binary files /dev/null and b/sources/intersex-2.gif differ diff --git a/sources/lesbian.gif b/sources/lesbian.gif new file mode 100644 index 0000000..67801f4 Binary files /dev/null and b/sources/lesbian.gif differ diff --git a/sources/nonbinary.gif b/sources/nonbinary.gif new file mode 100644 index 0000000..2ad84df Binary files /dev/null and b/sources/nonbinary.gif differ diff --git a/sources/pansexual.gif b/sources/pansexual.gif new file mode 100644 index 0000000..62421aa Binary files /dev/null and b/sources/pansexual.gif differ diff --git a/sources/pride.gif b/sources/pride.gif new file mode 100644 index 0000000..ad439d5 Binary files /dev/null and b/sources/pride.gif differ diff --git a/sources/trans.gif b/sources/trans.gif new file mode 100644 index 0000000..49ac03a Binary files /dev/null and b/sources/trans.gif differ