🎉 initial commit

This commit is contained in:
Kazhnuz 2025-02-02 19:42:18 +01:00
commit 3549dea846
22 changed files with 146 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
output
node_modules
package-lock.json

BIN
NFPixels-Regular.ttf Normal file

Binary file not shown.

14
README.md Normal file
View file

@ -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
```

67
data.json Normal file
View file

@ -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"]
}
]

51
main.js Normal file
View file

@ -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;
}
});

11
package.json Normal file
View file

@ -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"
}
}

BIN
sources/ace.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

BIN
sources/agender.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

BIN
sources/aromantic.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

BIN
sources/bisexual.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

BIN
sources/demiboy.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

BIN
sources/demigirl.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

BIN
sources/demiromantic.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

BIN
sources/demisexual.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

BIN
sources/gay.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
sources/intersex-1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

BIN
sources/intersex-2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

BIN
sources/lesbian.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
sources/nonbinary.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

BIN
sources/pansexual.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

BIN
sources/pride.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

BIN
sources/trans.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B