FIX: Render sidebar icons when no color is defined (#32)

This commit is contained in:
Manuel Kostka 2024-06-14 17:05:43 +01:00 committed by GitHub
parent 844be812d4
commit fb4fbf3e79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -172,7 +172,7 @@ export default {
categoryThemeList.forEach((str) => {
const [slug, icon, color, match] = str.split(",");
if (slug && icon && color) {
if (slug && icon) {
const category = site.categories.find((cat) => {
if (match === "partial") {
return cat.slug.toLowerCase().includes(slug.toLowerCase());
@ -186,9 +186,10 @@ export default {
categoryId: category.id,
prefixType: "icon",
prefixValue: icon,
prefixColor: color ? color : category.color,
};
if (!color.match(/categoryColo(u*)r/g)) {
if (color && !color.match(/categoryColo(u*)r/g)) {
opts.prefixColor = color.replace(/^#/, "");
}

View File

@ -2,7 +2,7 @@ category_icon_list:
default: "help,question-circle,#CC0000,partial|"
type: "list"
list_type: "simple"
description: 'Enter comma-delimited configuration for categories, in the format "slug,icon,color,match". Colour in format #123456 or "categoryColor" to use the default color for the category (same as the Badge color). If match is "partial" then the slug need only partially match the category-slug, otherwise an exact match is required'
description: 'Enter comma-delimited configuration for categories, in the format "slug,icon,color,match". Color can be in hex format (#123456) or left blank, then the default color for the category is used (same as the Badge color). If match is "partial" then the slug need only partially match the category-slug, otherwise an exact match is required'
svg_icons:
default: "question-circle"
type: "list"