Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix colors in categories

Smaug67398b38c64fb7fc
diff --git a/frontend/app/components/Sidebar/SidebarItem.vue b/frontend/app/components/Sidebar/SidebarItem.vue
index 7bf84f62..ce89d7e2 100644
--- a/frontend/app/components/Sidebar/SidebarItem.vue
+++ b/frontend/app/components/Sidebar/SidebarItem.vue
@@ -21,7 +21,8 @@ const { isOpened } = useSidebar();
const props = defineProps<{ item: Item }>();
const dotMenu = ref();
const customClass = computed(() => {
- if ('color' in props.item.data && props.item.data.color) return `item-icon ${getAppColor(props.item.data.color as number)}`;
+ if (props.item.data.type === 'category' && props.item.data.name === 'Mathématiques') console.log(props.item.data.color, getAppColor(props.item.data.color as number));
+ if ('color' in props.item.data && props.item.data.color != -1) return `item-icon ${getAppColor(props.item.data.color as number)}`;
});
const isActive = ref(false);
const icon = computed(() => {
diff --git a/frontend/app/composables/utils.ts b/frontend/app/composables/utils.ts
index 64a8d07c..d327e23c 100644
--- a/frontend/app/composables/utils.ts
+++ b/frontend/app/composables/utils.ts
@@ -14,7 +14,8 @@ export function useAvatar(user?: User): string {
export const appColors = ['blue', 'red', 'green', 'yellow', 'purple', 'pink', 'teal', 'grey'];
export function getAppColor(index: number = 0, defaultPrimary?: boolean): string {
- if (defaultPrimary && !index) return 'primary';
+ if (index == -1) return '';
+ if ((defaultPrimary && !index) || index == -2) return 'primary';
return appColors[index % appColors.length] || 'primary';
}