Compare commits

...

11 Commits

Author SHA1 Message Date
Wen Junhua 2cf1371c3e fix: remove debug logs 2023-12-31 13:26:09 +08:00
Wen Junhua a1a2e10481
Merge branch 'dev' into feat/add-icon-script 2023-12-31 13:24:13 +08:00
Wen Junhua 97a3f0064c feat: port script to node 2023-12-31 13:24:02 +08:00
James Panther c8f648d5c2
🔀 Merge pull request #763 from jpanther/dependabot/npm_and_yarn/prettier-plugin-tailwindcss-0.5.10
📌 Bump prettier-plugin-tailwindcss from 0.5.9 to 0.5.10
2023-12-29 11:05:10 +11:00
dependabot[bot] 28ba29ed4a
📌 Bump prettier-plugin-tailwindcss from 0.5.9 to 0.5.10
Bumps [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) from 0.5.9 to 0.5.10.
- [Release notes](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/compare/v0.5.9...v0.5.10)

---
updated-dependencies:
- dependency-name: prettier-plugin-tailwindcss
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-28 22:35:07 +00:00
James Panther 99ec58e91e
📝 Update changelog 2023-12-28 09:09:56 +11:00
James Panther e876aa07c7
🔀 Merge pull request #751 from wolfspyre/twcss33_950Vals
💄 update CSS Schemas to include TW3.3+ 950 color variants
2023-12-28 09:08:01 +11:00
James Panther 332324f264
🔀 Merge pull request #762 from jvanderaa/add_jv_site
📝 Adds personal site to users example
2023-12-28 09:03:15 +11:00
Josh VanDeraa d94a3d9707
Updates to include josh-v.com. 2023-12-27 08:18:38 -06:00
Wolf Noble 4c600e8065 🎨 adjust css files per prettier 2023-12-25 14:27:14 -06:00
Wolf Noble 68ac9dd321 💄 update CSS Schemas to include TW3.3+ 950 color variants 2023-12-23 10:00:12 +11:00
14 changed files with 871 additions and 207 deletions

View File

@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Ability to share articles to Telegram and Line ([#719](https://github.com/jpanther/congo/pull/719)) - Ability to share articles to Telegram and Line ([#719](https://github.com/jpanther/congo/pull/719))
- New icons for `line`, `google-scholar`, `mendeley` and `weibo` ([#719](https://github.com/jpanther/congo/pull/719), [#755](https://github.com/jpanther/congo/pull/755), [#756](https://github.com/jpanther/congo/pull/756)) - New icons for `line`, `google-scholar`, `mendeley` and `weibo` ([#719](https://github.com/jpanther/congo/pull/719), [#755](https://github.com/jpanther/congo/pull/755), [#756](https://github.com/jpanther/congo/pull/756))
- Weibo sharing links ([#756](https://github.com/jpanther/congo/pull/756)) - Weibo sharing links ([#756](https://github.com/jpanther/congo/pull/756))
- Support for Tailwind '950' colour variants ([#751](https://github.com/jpanther/congo/pull/751))
- Table of contents will now scroll if taller than the browser height ([#733](https://github.com/jpanther/congo/pull/733)) - Table of contents will now scroll if taller than the browser height ([#733](https://github.com/jpanther/congo/pull/733))
- Korean translation ([#731](https://github.com/jpanther/congo/pull/731)) - Korean translation ([#731](https://github.com/jpanther/congo/pull/731))

View File

@ -12,6 +12,7 @@
--color-neutral-700: 68, 64, 60; --color-neutral-700: 68, 64, 60;
--color-neutral-800: 41, 37, 36; --color-neutral-800: 41, 37, 36;
--color-neutral-900: 28, 25, 23; --color-neutral-900: 28, 25, 23;
--color-neutral-950: 12, 10, 9;
/* Lime */ /* Lime */
--color-primary-50: 247, 254, 231; --color-primary-50: 247, 254, 231;
--color-primary-100: 236, 252, 203; --color-primary-100: 236, 252, 203;
@ -23,6 +24,7 @@
--color-primary-700: 77, 124, 15; --color-primary-700: 77, 124, 15;
--color-primary-800: 63, 98, 18; --color-primary-800: 63, 98, 18;
--color-primary-900: 54, 83, 20; --color-primary-900: 54, 83, 20;
--color-primary-950: 26, 46, 5;
/* Emerald */ /* Emerald */
--color-secondary-50: 236, 253, 245; --color-secondary-50: 236, 253, 245;
--color-secondary-100: 209, 250, 229; --color-secondary-100: 209, 250, 229;
@ -34,4 +36,5 @@
--color-secondary-700: 4, 120, 87; --color-secondary-700: 4, 120, 87;
--color-secondary-800: 6, 95, 70; --color-secondary-800: 6, 95, 70;
--color-secondary-900: 6, 78, 59; --color-secondary-900: 6, 78, 59;
--color-secondary-950: 2, 44, 34;
} }

View File

@ -12,6 +12,7 @@
--color-neutral-700: 64, 64, 64; --color-neutral-700: 64, 64, 64;
--color-neutral-800: 38, 38, 38; --color-neutral-800: 38, 38, 38;
--color-neutral-900: 23, 23, 23; --color-neutral-900: 23, 23, 23;
--color-neutral-950: 10, 10, 10;
/* Rose */ /* Rose */
--color-primary-50: 255, 241, 242; --color-primary-50: 255, 241, 242;
--color-primary-100: 255, 228, 230; --color-primary-100: 255, 228, 230;
@ -23,6 +24,7 @@
--color-primary-700: 190, 18, 60; --color-primary-700: 190, 18, 60;
--color-primary-800: 159, 18, 57; --color-primary-800: 159, 18, 57;
--color-primary-900: 136, 19, 55; --color-primary-900: 136, 19, 55;
--color-primary-950: 76, 5, 25;
/* Green */ /* Green */
--color-secondary-50: 240, 253, 244; --color-secondary-50: 240, 253, 244;
--color-secondary-100: 220, 252, 231; --color-secondary-100: 220, 252, 231;
@ -34,4 +36,5 @@
--color-secondary-700: 21, 128, 61; --color-secondary-700: 21, 128, 61;
--color-secondary-800: 22, 101, 52; --color-secondary-800: 22, 101, 52;
--color-secondary-900: 20, 83, 45; --color-secondary-900: 20, 83, 45;
--color-secondary-950: 5, 46, 22;
} }

View File

@ -12,6 +12,7 @@
--color-neutral-700: 63, 63, 70; --color-neutral-700: 63, 63, 70;
--color-neutral-800: 39, 39, 42; --color-neutral-800: 39, 39, 42;
--color-neutral-900: 24, 24, 27; --color-neutral-900: 24, 24, 27;
--color-neutral-950: 3, 7, 18;
/* Violet */ /* Violet */
--color-primary-50: 245, 243, 255; --color-primary-50: 245, 243, 255;
--color-primary-100: 237, 233, 254; --color-primary-100: 237, 233, 254;
@ -23,6 +24,7 @@
--color-primary-700: 109, 40, 217; --color-primary-700: 109, 40, 217;
--color-primary-800: 91, 33, 182; --color-primary-800: 91, 33, 182;
--color-primary-900: 76, 29, 149; --color-primary-900: 76, 29, 149;
--color-primary-950: 46, 16, 101;
/* Fuchsia */ /* Fuchsia */
--color-secondary-50: 253, 244, 255; --color-secondary-50: 253, 244, 255;
--color-secondary-100: 250, 232, 255; --color-secondary-100: 250, 232, 255;
@ -34,4 +36,5 @@
--color-secondary-700: 162, 28, 175; --color-secondary-700: 162, 28, 175;
--color-secondary-800: 134, 25, 143; --color-secondary-800: 134, 25, 143;
--color-secondary-900: 112, 26, 117; --color-secondary-900: 112, 26, 117;
--color-secondary-950: 74, 4, 78;
} }

View File

@ -12,6 +12,7 @@
--color-neutral-700: 68, 64, 60; --color-neutral-700: 68, 64, 60;
--color-neutral-800: 41, 37, 36; --color-neutral-800: 41, 37, 36;
--color-neutral-900: 28, 25, 23; --color-neutral-900: 28, 25, 23;
--color-neutral-950: 12, 10, 9;
/* Orange */ /* Orange */
--color-primary-50: 255, 247, 237; --color-primary-50: 255, 247, 237;
--color-primary-100: 255, 237, 213; --color-primary-100: 255, 237, 213;
@ -23,6 +24,7 @@
--color-primary-700: 194, 65, 12; --color-primary-700: 194, 65, 12;
--color-primary-800: 154, 52, 18; --color-primary-800: 154, 52, 18;
--color-primary-900: 124, 45, 18; --color-primary-900: 124, 45, 18;
--color-primary-950: 69, 10, 10;
/* Rose */ /* Rose */
--color-secondary-50: 255, 241, 242; --color-secondary-50: 255, 241, 242;
--color-secondary-100: 255, 228, 230; --color-secondary-100: 255, 228, 230;
@ -34,4 +36,5 @@
--color-secondary-700: 190, 18, 60; --color-secondary-700: 190, 18, 60;
--color-secondary-800: 159, 18, 57; --color-secondary-800: 159, 18, 57;
--color-secondary-900: 136, 19, 55; --color-secondary-900: 136, 19, 55;
--color-secondary-950: 76, 5, 25;
} }

View File

@ -12,6 +12,7 @@
--color-neutral-700: 51, 65, 85; --color-neutral-700: 51, 65, 85;
--color-neutral-800: 30, 41, 59; --color-neutral-800: 30, 41, 59;
--color-neutral-900: 15, 23, 42; --color-neutral-900: 15, 23, 42;
--color-neutral-950: 2, 6, 23;
/* Blue */ /* Blue */
--color-primary-50: 239, 246, 255; --color-primary-50: 239, 246, 255;
--color-primary-100: 219, 234, 254; --color-primary-100: 219, 234, 254;
@ -23,6 +24,7 @@
--color-primary-700: 29, 78, 216; --color-primary-700: 29, 78, 216;
--color-primary-800: 30, 64, 175; --color-primary-800: 30, 64, 175;
--color-primary-900: 30, 58, 138; --color-primary-900: 30, 58, 138;
--color-primary-950: 23, 37, 8;
/* Cyan */ /* Cyan */
--color-secondary-50: 236, 254, 255; --color-secondary-50: 236, 254, 255;
--color-secondary-100: 207, 250, 254; --color-secondary-100: 207, 250, 254;
@ -34,4 +36,5 @@
--color-secondary-700: 14, 116, 144; --color-secondary-700: 14, 116, 144;
--color-secondary-800: 21, 94, 117; --color-secondary-800: 21, 94, 117;
--color-secondary-900: 22, 78, 99; --color-secondary-900: 22, 78, 99;
--color-secondary-950: 8, 51, 69;
} }

View File

@ -12,6 +12,7 @@
--color-neutral-700: 51, 65, 85; --color-neutral-700: 51, 65, 85;
--color-neutral-800: 30, 41, 59; --color-neutral-800: 30, 41, 59;
--color-neutral-900: 15, 23, 42; --color-neutral-900: 15, 23, 42;
--color-neutral-950: 10, 10, 10;
/* Indigo */ /* Indigo */
--color-primary-50: 238, 242, 255; --color-primary-50: 238, 242, 255;
--color-primary-100: 224, 231, 255; --color-primary-100: 224, 231, 255;
@ -23,6 +24,7 @@
--color-primary-700: 67, 56, 202; --color-primary-700: 67, 56, 202;
--color-primary-800: 55, 48, 163; --color-primary-800: 55, 48, 163;
--color-primary-900: 49, 46, 129; --color-primary-900: 49, 46, 129;
--color-primary-950: 30, 27, 75;
/* Pink */ /* Pink */
--color-secondary-50: 253, 242, 248; --color-secondary-50: 253, 242, 248;
--color-secondary-100: 252, 231, 243; --color-secondary-100: 252, 231, 243;
@ -34,4 +36,5 @@
--color-secondary-700: 190, 24, 93; --color-secondary-700: 190, 24, 93;
--color-secondary-800: 157, 23, 77; --color-secondary-800: 157, 23, 77;
--color-secondary-900: 131, 24, 67; --color-secondary-900: 131, 24, 67;
--color-secondary-950: 80, 7, 36;
} }

View File

@ -12,6 +12,7 @@
--color-neutral-700: 55, 65, 81; --color-neutral-700: 55, 65, 81;
--color-neutral-800: 31, 41, 55; --color-neutral-800: 31, 41, 55;
--color-neutral-900: 17, 24, 39; --color-neutral-900: 17, 24, 39;
--color-neutral-950: 17, 24, 39;
/* Slate */ /* Slate */
--color-primary-50: 248, 250, 252; --color-primary-50: 248, 250, 252;
--color-primary-100: 241, 245, 249; --color-primary-100: 241, 245, 249;
@ -23,6 +24,7 @@
--color-primary-700: 51, 65, 85; --color-primary-700: 51, 65, 85;
--color-primary-800: 30, 41, 59; --color-primary-800: 30, 41, 59;
--color-primary-900: 15, 23, 42; --color-primary-900: 15, 23, 42;
--color-primary-950: 2, 6, 23;
/* Gray */ /* Gray */
--color-secondary-50: 249, 250, 251; --color-secondary-50: 249, 250, 251;
--color-secondary-100: 243, 244, 246; --color-secondary-100: 243, 244, 246;
@ -34,4 +36,5 @@
--color-secondary-700: 55, 65, 81; --color-secondary-700: 55, 65, 81;
--color-secondary-800: 31, 41, 55; --color-secondary-800: 31, 41, 55;
--color-secondary-900: 17, 24, 39; --color-secondary-900: 17, 24, 39;
--color-secondary-950: 10, 10, 10;
} }

View File

@ -65,5 +65,6 @@ The list below is just a handful of the websites that are built using the Congo
| [kom.al](https://kom.al) | Personal Site | | [kom.al](https://kom.al) | Personal Site |
| [andrea.mortaro.it](https://andrea.mortaro.it) | Personal Site and Blog | | [andrea.mortaro.it](https://andrea.mortaro.it) | Personal Site and Blog |
| [yoganath.me](https://yoganath.me) | Personal Site and Blog | | [yoganath.me](https://yoganath.me) | Personal Site and Blog |
| [josh-v.com](https://josh-v.com) | Personal Site and Tech blog |
**Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md). **Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md).

757
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,8 @@
"dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w", "dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w",
"build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit", "build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit",
"example": "hugo server --bind 0.0.0.0 -p 8008 --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ ", "example": "hugo server --bind 0.0.0.0 -p 8008 --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ ",
"lighthouse": "lhci autorun" "lighthouse": "lhci autorun",
"add-icon": "node scripts/index.js add-icon"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -32,11 +33,12 @@
"@tailwindcss/typography": "^0.5.10", "@tailwindcss/typography": "^0.5.10",
"chart.js": "^4.4.1", "chart.js": "^4.4.1",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"jsdom": "^23.0.1",
"katex": "^0.16.9", "katex": "^0.16.9",
"mermaid": "^10.6.1", "mermaid": "^10.6.1",
"prettier": "^3.1.1", "prettier": "^3.1.1",
"prettier-plugin-go-template": "^0.0.15", "prettier-plugin-go-template": "^0.0.15",
"prettier-plugin-tailwindcss": "^0.5.9", "prettier-plugin-tailwindcss": "^0.5.10",
"quicklink": "^2.3.0", "quicklink": "^2.3.0",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"tailwindcss": "^3.4.0", "tailwindcss": "^3.4.0",

11
scripts/index.js 100644
View File

@ -0,0 +1,11 @@
#!/usr/bin/env node
const { program } = require("commander");
const { add_icon_to_congo } = require("./update_icon");
// Adds an icon to the project.
program
.command("add-icon <icon_name>")
.description("Add icon to the project")
.action(add_icon_to_congo);
program.parse(process.argv);

View File

@ -0,0 +1,97 @@
const jsdom = require("jsdom");
const fs = require("fs");
const DOC_DIR = "./exampleSite/content/samples/icons";
const FONTAWESOME_VERSION = "v6.5.1";
const DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |";
/**
* Saves an icon to the congo project and update documentation.
* @param {string} icon_name Icon name from Font Awesome to download
* @returns null
*/
const add_icon_to_congo = async (icon_name) => {
try {
const icon_url = create_icon_url(icon_name, FONTAWESOME_VERSION);
const file = await get_file(icon_url);
const final_svg = modify_svg_string(file);
const icon_download_path = create_icon_download_path(icon_name);
save_file(icon_download_path, final_svg);
add_documentation(icon_name);
} catch (e) {
console.log(e);
return;
}
};
const modify_svg_string = (svg_string) => {
try {
dom = new jsdom.JSDOM(svg_string);
svg = dom.window.document.documentElement.querySelector("svg");
svg.querySelector("path").setAttribute("fill", "currentColor");
return svg.outerHTML;
} catch (e) {
throw new Error("Invalid SVG file");
}
};
const create_icon_url = (icon_name, fontawesome_version) => {
return `https://site-assets.fontawesome.com/releases/${fontawesome_version}/svgs/brands/${icon_name}.svg`;
};
const create_icon_download_path = (icon_name) => {
return `./assets/icons/${icon_name}.svg`;
};
const get_file = async (url) => {
console.log("Getting file at " + url + "...");
const response = await fetch(url);
if (response.status >= 400) {
throw new Error("Could not download icon / icon not found");
}
console.log("File retrieved!");
return response.text();
};
const save_file = (file_path, file) => {
console.log("Saving file at " + file_path + "...");
fs.writeFile(file_path, file, function (err) {
if (err) throw err;
console.log("File saved!");
});
};
const add_documentation = async (icon_name) => {
files = get_md_docs();
for (const file of files) {
const file_path = `${DOC_DIR}/${file}`;
const file_contents = fs.readFileSync(file_path, "utf8");
const file_result = process_file(file_contents, icon_name);
// Save file_result to file_path
fs.writeFile(file_path, file_result, function (err) {
if (err) throw err;
});
console.log(`Updated ${file_path}`);
}
};
/**
* Process the file contents to include the icon name.
* @param {string} file_contents contents of the documentation files.
* @returns {string} processed file contents.
*/
const process_file = (file_contents, icon_name) => {
const [headers, table] = file_contents.split(DEFAULT_TABLE_DELIMITER);
const table_rows = table.split("\n").map((x) => x.trim()).filter((row) => row !== "");
table_rows.push(table_rows[0].replace("amazon", icon_name));
table_rows.sort();
const new_table = table_rows.join("\n");
return `${headers.trimEnd()}\n${DEFAULT_TABLE_DELIMITER}\n${new_table}\n`;
};
const get_md_docs = () => {
return fs.readdirSync(DOC_DIR).filter((file) => file.endsWith(".md"));
};
module.exports = { add_icon_to_congo };

View File

@ -1,184 +0,0 @@
import argparse
import bs4
import re
import logging
import requests
import os
from typing import Tuple, List
DEFAULT_FONTAWESOME_VERSION = "v6.5.1"
DEFAULT_BASE_URL = (
"https://site-assets.fontawesome.com/releases/%s/svgs/brands/"
% DEFAULT_FONTAWESOME_VERSION
+ "%s.svg"
)
DEFAULT_BASE_PATH = os.path.join(os.getcwd(), "..")
DEFAULT_ICON_DIR_PATH = os.path.join(
DEFAULT_BASE_PATH,
"assets",
"icons",
)
DEFAULT_SVG_ATTR = {"fill": "currentColor"}
DEFAULT_ICON_DOCS_DIR = os.path.join(
DEFAULT_BASE_PATH, "exampleSite", "content", "samples", "icons"
)
DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |"
def download_icon(download_url: str) -> None:
"""Downloads the icon based on the URL"""
with requests.Session() as s:
return s.get(download_url).content
def update_svg_to_theme(svg: bytes) -> bytes:
"""Update the current color of SVG to match theme"""
soup = bs4.BeautifulSoup(svg, features="html.parser")
# Update attrs
svg_elem = soup.find("svg").find("path")
for k, v in DEFAULT_SVG_ATTR.items():
svg_elem[k] = v
# Remove comments
return re.sub(r"<!.*?->", "", str(soup))
def update_docs(icon_name: str) -> None:
"""Update icon to docs"""
files = get_folder_md(DEFAULT_ICON_DOCS_DIR)
for file in files:
# Parse Table
logging.debug(f"reading {file}")
with open(file) as f:
file_data = f.read()
table_fmt, table = parse_table(file_data)
table.append(str(table[0]).replace("amazon", icon_name))
# Write Doc
with open(file, "w") as f:
f.write(
"\n".join(
(
table_fmt,
DEFAULT_TABLE_DELIMITER,
"\n".join(sorted(table)),
)
)
)
def get_folder_md(dir_path: str) -> List[str]:
return list(
map(
lambda path: os.path.join(dir_path, path),
filter(lambda x: x.endswith(".md"), os.listdir(dir_path)),
)
)
def parse_table(table_str: str) -> Tuple[str, List[str]]:
"""Parse the table to a list of (article_fmt, (icon_name, icon_shortcode))"""
headers, table = table_str.split(DEFAULT_TABLE_DELIMITER)
return headers.strip(), list(
filter(
lambda x: len(x.strip()) > 0,
map(
lambda x: x.strip(),
table.split("\n"),
),
)
)
def save_file(name: str, svg: str) -> None:
file_name = f"{name}.svg"
logging.debug(f"saving icon to {file_name}")
with open(
os.path.join(
DEFAULT_ICON_DIR_PATH,
file_name,
),
"w",
) as file:
file.write(svg)
def parse_args() -> Tuple[str, str, int]:
"""
Parse arguments.
Returns the following:
1. Icon URL: str
2. Icon Representation :str
3. Log Level: int
"""
parser = argparse.ArgumentParser(description="This script adds an icon to this congo theme and updates the relevant documentation.")
parser.add_argument(
"-v",
"--verbose",
help="show debug messages during script execution",
required=False,
default=False,
action="store_true",
)
parser.add_argument(
"-u",
"--url",
help="full url of the icon svg, defaults to fortawesome url",
required=False,
nargs=1,
)
parser.add_argument(
"name",
help="name of the icon to be added. EG: `github`",
)
parse_res = parser.parse_args()
url = DEFAULT_BASE_URL % parse_res.name
if parse_res.url is not None:
url = parse_res.url[0]
log_level = logging.DEBUG if parse_res.verbose else logging.INFO
return url, parse_res.name, log_level
if __name__ == "__main__":
icon_url, icon_name, log_level = parse_args()
# Setup logging
logging.basicConfig(
level=log_level,
format="%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
logging.debug(f"Using default base URL: {DEFAULT_BASE_URL}")
logging.info(f"Using Log Level: {logging.getLevelName(log_level)}")
logging.info(f"Using URL: {icon_url}")
logging.info(f"Using Icon Name: {icon_name}")
try:
# Download Icon
logging.debug(f"fetching icon at {icon_url}")
svg_content = download_icon(icon_url)
# Patch svg attrs
logging.debug(
f"remove svg comments and update svg attrs with {DEFAULT_SVG_ATTR}"
)
final_svg = update_svg_to_theme(svg_content)
# Save file
logging.debug(f"saving icon to {DEFAULT_ICON_DIR_PATH}")
save_file(icon_name, final_svg)
# Write to docs
logging.debug(f"updating docs from {DEFAULT_ICON_DOCS_DIR} dir")
update_docs(icon_name)
except Exception as e:
logging.critical(f"error adding icon {str(e)}")
else:
logging.info(f"{icon_name} added successfully")