diff --git a/README.md b/README.md index 6dc338a..6471567 100644 --- a/README.md +++ b/README.md @@ -42,26 +42,24 @@ You can embed one of the available cards in your README using either Markdown ** Here is a list of cards that can currently be used: -| Available Cards | Example | Preview | -| --------------- | ------- | ------- | -| `jokes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/jokes-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/jokes-card?theme=dark) | -| `programming-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card) | -| `motivational-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card) | -| `word-of-the-day-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/word-of-the-day-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/word-of-the-day-card) | -| `challenge-of-the-week-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/challenge-of-the-week-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/challenge-of-the-week-card) | -| `team-work-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/team-work-quote-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/team-work-quote-card) | -| `bhagavad-geeta-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/bhagavad-geeta-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/bhagavad-geeta-card) | -| `random-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-card) | -| `programming-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-facts-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-facts-card?theme=dark) | -| `top-tweets-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/top-tweets-card)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/top-tweets-card) | -| `spanish-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/spanish-quote-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/spanish-quote-card?theme=dark) | - -| `fun-fact-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/fun-fact-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/fun-fact-card?theme=dark) | - -| `github-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/github-facts-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/github-facts-card?theme=dark) | -| `random-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-facts-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-facts-card?theme=dark) | -| `breaking-bad-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/breaking-bad-quote-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/breaking-bad-quote-card?theme=dark) | -| `got-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/got-quotes-card?theme=dark)` | ![Card](https://afraid-ninnetta-github-cards.koyeb.app/got-quotes-card?theme=dark) | +| Available Cards | Example | +| --------------- | ------- | +| `jokes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/jokes-card?theme=dark)` | +| `programming-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card)` | +| `motivational-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card)` | +| `word-of-the-day-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/word-of-the-day-card)` | +| `challenge-of-the-week-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/challenge-of-the-week-card)` | +| `team-work-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/team-work-quote-card)` | +| `bhagavad-geeta-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/bhagavad-geeta-card)` | +| `random-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-card)` | +| `programming-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-facts-card?theme=dark)` | +| `top-tweets-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/top-tweets-card)` | +| `spanish-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/spanish-quote-card?theme=dark)` | +| `fun-fact-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/fun-fact-card?theme=dark)` | +| `github-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/github-facts-card?theme=dark)` | +| `random-facts-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/random-facts-card?theme=dark)` | +| `breaking-bad-quote-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/breaking-bad-quote-card?theme=dark)` | +| `got-quotes-card` | `![Card](https://afraid-ninnetta-github-cards.koyeb.app/got-quotes-card?theme=dark)` | ## Themes @@ -137,6 +135,10 @@ args: { (Limited to HTML Cards)
![Card](https://afraid-ninnetta-github-cards.koyeb.app/motivational-quotes-card?theme=techy) +- #### `Neon_Horizon` Theme Card + (Limited to HTML Cards)
+ ![Card](https://afraid-ninnetta-github-cards.koyeb.app/programming-quotes-card?theme=neon_horizon) + ## Contributing ### Adding a New Card @@ -159,6 +161,13 @@ You can also create cards in HTML and CSS! Check out the `src/cards/motivational 4. Define your theme in `src/themes.js` (refer to existing themes for structure). 5. Update the `src/help.js` file and the `README` with your new theme's API reference. +### Contributing Guidelines +- Ensure your code is properly formatted and follows the existing code style. +- Ensure your code is well-commented and tested before creating a pull request. +- Ensure your card/theme is unique and not a duplicate of an existing card/theme. +- Ensure your card/theme is not offensive or inappropriate. +- Do not commit package-lock.json, yarn.lock, package.json, or any other unnecessary files. + ## Additional Information For more information, visit [https://afraid-ninnetta-github-cards.koyeb.app/](https://afraid-ninnetta-github-cards.koyeb.app/). diff --git a/src/cards/programming-quote.js b/src/cards/programming-quote.js index c3231c9..4bc4620 100644 --- a/src/cards/programming-quote.js +++ b/src/cards/programming-quote.js @@ -1,8 +1,9 @@ const express = require("express"); const router = express.Router(); const fs = require("fs").promises; -const { generateCard, CARD_AGE, Languages } = require("../card-generator"); +const { generateCard, CARD_AGE, Languages, generateHTMLCard } = require("../card-generator"); const { parseOptions } = require("../options-parser"); +const { HTML_THEMES } = require("../html-themes"); const DATA_FILE_PATH = "./src/data/programming_quotes.json"; const DEFAULT_THEME = "dark_2"; @@ -25,12 +26,19 @@ router.get("/", handleTheme, handleOptions, async (req, res) => { const random_quote = quotes[Math.floor(Math.random() * quotes.length)]; const quote_content = `${random_quote.quote}\n\n- ${random_quote.author}`; - const quote_card = await generateCard( - quote_content, - req.theme, - req.options, - Languages.ENGLISH - ); + let quote_card = ""; + let all_html_themes = Object.keys(HTML_THEMES); + + if(all_html_themes.includes(req.theme.toUpperCase())) { + quote_card = await generateHTMLCard(quote_content, Languages.ENGLISH, HTML_THEMES[req.theme.toUpperCase()]); + }else{ + quote_card = await generateCard( + quote_content, + req.theme, + req.options, + Languages.ENGLISH + ); + } res.writeHead(200, { "Content-Type": "image/svg+xml", diff --git a/src/help.js b/src/help.js index 09d0d61..550e7e9 100644 --- a/src/help.js +++ b/src/help.js @@ -93,6 +93,22 @@ router.get("/", (req, res) => { `${baseurl}/random-facts-card?theme=lemonade`, ], }, + "techy": { + info: "Techy theme", + supported_cards: ["programming-quotes-card", "motivational-quotes-card"], + example: [ + `${baseurl}/programming-quotes-card?theme=techy`, + `${baseurl}/motivational-quotes-card?theme=techy`, + ], + }, + "neon_horizon": { + info: "Neon horizon theme", + supported_cards: ["programming-quotes-card", "motivational-quotes-card"], + example: [ + `${baseurl}/programming-quotes-card?theme=neon_horizon`, + `${baseurl}/motivational-quotes-card?theme=neon_horizon`, + ], + }, "custom": { info: "Custom theme", args: { diff --git a/src/html-themes.js b/src/html-themes.js index 278bebe..1b865d7 100644 --- a/src/html-themes.js +++ b/src/html-themes.js @@ -6,6 +6,17 @@ const HTML_THEMES = {
+ `, + 'NEON_HORIZON': ` +
+
+
+
+
+
+ {{card_content}} +
+
` };