diff --git a/static/js/markdown.js b/static/js/markdown.js index 0d8b97d..345e612 100644 --- a/static/js/markdown.js +++ b/static/js/markdown.js @@ -3,6 +3,10 @@ const Mode = { Dark: 2, }; +/** + * Change the svg color theme based on the mode + * @param {Mode} mode + */ const svgChangeTheme = (mode) => { for (const item of document.getElementsByTagName("img")) { if (!item.src.startsWith("data:image/svg+xml;base64,")) { @@ -10,12 +14,20 @@ const svgChangeTheme = (mode) => { continue; } - /** Convert to grayscale */ + /** + * Convert to grayscale + * @param {{r: number, g: number, b: number}} color + * @returns Number between 0 and 255 + */ const colorToGrayscale = (color) => { return 0.3 * color.r + 0.59 * color.g + 0.11 * color.b; }; - /** Extract color using canvas2d */ + /** + * Extract color using canvas2d + * @param {HTMLImageElement} image Image source + * @returns Colors represeting the image + */ const extractColors = (image) => { const canvas = document.createElement("canvas"); canvas.width = image.width;