Logo Cinquin Andy Signature

Icons available in Obsidian

Développeur Freelance - Logo

The sites and the associated resources.

Icons available in Obsidian

Posted on September 23, 2024 -  by Andy Cinquin

Obsidian iconsLibs icons

I create a small script for windows and linux to see all the icons currently available in Obsidian, they use Lucide-icon. (https://lucide.dev/icons/) but don't have the latest version, so here are the little scripts in question, and the icons :
#!/bin/bash
# Output file names
OUTPUT_FILE_SIMPLE="liste_fichiers_svg.txt"
OUTPUT_FILE_SPECIAL="liste_fichiers_svg_special.txt"
OUTPUT_FILE_SPECIAL_PLUS="icons_obsidian.md"
# Delete output files if they already exist
[ -f "$OUTPUT_FILE_SIMPLE" ] && rm "$OUTPUT_FILE_SIMPLE"
[ -f "$OUTPUT_FILE_SPECIAL" ] && rm "$OUTPUT_FILE_SPECIAL"
[ -f "$OUTPUT_FILE_SPECIAL_PLUS" ] && rm "$OUTPUT_FILE_SPECIAL_PLUS"
# Adds header to special file
echo "> [!info]- Icons" > "$OUTPUT_FILE_SPECIAL"
echo "> [!info]- Icons" > "$OUTPUT_FILE_SPECIAL_PLUS"
# Loops through all SVG files in current directory
for f in *.svg; do
    echo "$f" >> "$OUTPUT_FILE_SIMPLE"
    # Removes .svg extension for special file
    filename="${f%.svg}"
    # Creates link and displays image
    icon_url="https://lucide.dev/icons/$filename"
    echo "> - [$filename]($icon_url)" >> "$OUTPUT_FILE_SPECIAL"
    echo "> - [$filename]($icon_url)" >> "$OUTPUT_FILE_SPECIAL_PLUS"
done
# Adds additional content to the special plus file
cat <<EOF >> "$OUTPUT_FILE_SPECIAL_PLUS"
\`\\`dataviewjs
const icons = dv.current().file.lists.map((l) => l.text);
await dv.table(
    ["Icon", "Name"],
    icons.map((l) => ["", l])
);
dv.container.querySelectorAll("tbody tr").forEach((tr, index) => {
    const td = tr.querySelector("td");
    obsidian.setIcon(td, icons[index], 100);
});
\`\`\`
EOF
echo "The list of SVG files has been saved in $OUTPUT_FILE_SIMPLE, $OUTPUT_FILE_SPECIAL and $OUTPUT_FILE_SPECIAL_PLUS."
&& for windows :
@echo off
setlocal enabledelayedexpansion
REM Output file names
set OUTPUT_FILE_SIMPLE=liste_fichiers_svg.txt
set OUTPUT_FILE_SPECIAL=liste_fichiers_svg_special.txt
set OUTPUT_FILE_SPECIAL_PLUS=icons_obsidian.md
REM Deletes output files if they already exist
if exist %OUTPUT_FILE_SIMPLE% del %OUTPUT_FILE_SIMPLE%
if exist %OUTPUT_FILE_SPECIAL% del %OUTPUT_FILE_SPECIAL%
if exist %OUTPUT_FILE_SPECIAL_PLUS% del %OUTPUT_FILE_SPECIAL_PLUS%
REM Adds header to special file
echo ^> [!info]- Icons > %OUTPUT_FILE_SPECIAL%
echo ^> [!info]- Icons > %OUTPUT_FILE_SPECIAL_PLUS%
REM Loops through all SVG files in current directory
for %%f in (*.svg) do (
    echo %%f >> %OUTPUT_FILE_SIMPLE%
    REM Removes the .svg extension for the special file
    set "filename=%%~nf"
    echo ^> - !filename! >> %OUTPUT_FILE_SPECIAL%
    echo ^> - !filename! >> %OUTPUT_FILE_SPECIAL_PLUS%
)
REM Adds additional content to the special file plus
(
echo.
echo ^^^```dataviewjs
echo const icons = dv.current().file.lists.map((l) ^> l.text^);
echo await dv.table(
echo ^^^[^^^"Icon^^^", ^^^"Name^^^"],
echo icons.map((l) ^> ^[^^^"^^^", l^^^]^)
echo ^);
echo dv.container.querySelectorAll("tbody tr").forEach((tr, index) ^> ^{
echo ^^^const td = tr.querySelector("td");
echo ^^^obsidian.setIcon(td, icons[index], 100);
echo ^^^}^);
echo ^^^````
) >> %OUTPUT_FILE_SPECIAL_PLUS%
echo The list of SVG files has been saved in %OUTPUT_FILE_SIMPLE%, %OUTPUT_FILE_SPECIAL% and %OUTPUT_FILE_SPECIAL_PLUS%.
endlocal
break
[!info]- Icons



Thank you for your visit, feel free to contact me for any information, quote or collaboration proposal. I will be happy to answer you as soon as possible.
Did you like this article? Feel free to share it!

DEVELOP YOUR PROJECTS TOGETHER

An idea, a project? I'm here to answer your questions and help you.
I'd be delighted to discuss your project with you!