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.

Rename get app color for accent color

Smaug673984f589f63d26
diff --git a/frontend/app/components/AppColorPicker.vue b/frontend/app/components/AppColorPicker.vue
index b041fceb..f72fbc83 100644
--- a/frontend/app/components/AppColorPicker.vue
+++ b/frontend/app/components/AppColorPicker.vue
@@ -28,15 +28,15 @@
:key="index"
class="color-option"
:style="{
- backgroundColor: getAppColor(index) ? `var(--${getAppColor(index)})` : '#fff',
- outline: modelValue === index ? `2px solid var(--${getAppColor(index)})` : 'none',
+ backgroundColor: getAppAccent(index) ? `var(--${getAppAccent(index)})` : '#fff',
+ outline: modelValue === index ? `2px solid var(--${getAppAccent(index)})` : 'none',
}"
:class="{ selected: modelValue === index }"
@click="selectColor(index)"
>
<div class="hint-wrapper">
<p class="hint-tooltip">
- {{ getAppColor(index) }}
+ {{ getAppAccent(index) }}
</p>
</div>
</div>
@@ -46,7 +46,7 @@
<script setup lang="ts">
import { appColors } from '~/helpers/constants';
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const props = defineProps<{ modelValue?: number; nullable?: boolean }>();
const emit = defineEmits<{ (e: 'update:modelValue', color: number): void }>();
diff --git a/frontend/app/components/DocumentCard.vue b/frontend/app/components/DocumentCard.vue
index e27dc01d..94b0e245 100644
--- a/frontend/app/components/DocumentCard.vue
+++ b/frontend/app/components/DocumentCard.vue
@@ -3,7 +3,7 @@
<div class="top">
<div class="header">
<span style="display: flex">
- <Icon :name="category?.icon || 'files'" display="xl" :class="`category-icon ${getAppColor(document.color || category?.color as number, true)}`" />
+ <Icon :name="category?.icon || 'files'" display="xl" :class="`category-icon ${getAppAccent(document.color || category?.color as number, true)}`" />
<NuxtLink :to="`/dashboard/docs/${document.id}`" class="document-title">{{ document.name }}</NuxtLink>
</span>
<NodeDotMenu :node="document" :user="user" @delete="deleteDoc" />
@@ -43,7 +43,7 @@ const nodesStore = useNodesStore();
const userStore = useUserStore();
const { shortDate } = useDateFormatters();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const category = computed(() => nodesStore.getById(props.document.parent_id || ''));
userStore.fetchPublicUser(props.document.user_id);
diff --git a/frontend/app/components/DocumentLine.vue b/frontend/app/components/DocumentLine.vue
index 45b64242..197b7c1e 100644
--- a/frontend/app/components/DocumentLine.vue
+++ b/frontend/app/components/DocumentLine.vue
@@ -5,7 +5,7 @@
<Icon
:name="document.icon || category?.icon || 'files'"
display="xl"
- :class="['icon', getAppColor(document.color || category?.color as number, true)]"
+ :class="['icon', getAppAccent(document.color || category?.color as number, true)]"
/>
<NuxtLink :to="`/dashboard/docs/${document.id}`" class="name">{{ document.name }}</NuxtLink>
</div>
@@ -37,7 +37,7 @@ const categoriesStore = useNodesStore();
const userStore = useUserStore();
const { shortDate } = useDateFormatters();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const category = computed(() => categoriesStore.getById(props.document.parent_id || ''));
userStore.fetchPublicUser(props.document.user_id);
diff --git a/frontend/app/components/Kanban/KanbanCard.vue b/frontend/app/components/Kanban/KanbanCard.vue
index eb451f70..30033799 100644
--- a/frontend/app/components/Kanban/KanbanCard.vue
+++ b/frontend/app/components/Kanban/KanbanCard.vue
@@ -2,7 +2,7 @@
<div class="kanban-card" draggable="true" @dragstart="onDragStart" @dragend="onDragEnd">
<div class="card-header">
<div class="card-header-left">
- <span class="card-icon" :class="getAppColor(node.color as number || props.parent.color as number, true)">
+ <span class="card-icon" :class="getAppAccent(node.color as number || props.parent.color as number, true)">
<Icon :name="node.icon || 'file'" display="sm" />
</span>
@@ -29,7 +29,7 @@ import type { Node } from '~/stores';
const props = defineProps<{ node: Node; parent: Node }>();
const emit = defineEmits<{ dragStart: [node: Node]; dragEnd: [] }>();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const { shortDate } = useDateFormatters();
const parsedTags = computed(() => {
diff --git a/frontend/app/components/Kanban/KanbanColumn.vue b/frontend/app/components/Kanban/KanbanColumn.vue
index cf9432ef..14ce5dd3 100644
--- a/frontend/app/components/Kanban/KanbanColumn.vue
+++ b/frontend/app/components/Kanban/KanbanColumn.vue
@@ -2,7 +2,12 @@
<div class="kanban-column" :class="{ 'drag-over': isDragOver }" @dragover.prevent="onDragOver" @dragleave="onDragLeave" @drop="onDrop">
<div class="column-header">
<div class="column-title-row">
- <button class="column-color-btn" title="Change color" :style="{ background: `var(--${getAppColor(column.color, true)})` }" @click="toggleColorPicker" />
+ <button
+ class="column-color-btn"
+ title="Change color"
+ :style="{ background: `var(--${getAppAccent(column.color, true)})` }"
+ @click="toggleColorPicker"
+ />
<input
v-if="isEditing"
ref="titleInput"
@@ -31,7 +36,7 @@
<button
v-for="(_, index) in appColors"
:key="index"
- :style="{ backgroundColor: `var(--${getAppColor(index, true)})` }"
+ :style="{ backgroundColor: `var(--${getAppAccent(index, true)})` }"
:class="['color-option ', { active: column.color === index }]"
@click="selectColor(index)"
/>
@@ -89,7 +94,7 @@ const emit = defineEmits<{
cardDragEnd: [];
}>();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const isDragOver = ref(false);
const isEditing = ref(false);
diff --git a/frontend/app/components/MarkdownEditor/ColorPickerModal.vue b/frontend/app/components/MarkdownEditor/ColorPickerModal.vue
index 68f2fd94..a7d02c3f 100644
--- a/frontend/app/components/MarkdownEditor/ColorPickerModal.vue
+++ b/frontend/app/components/MarkdownEditor/ColorPickerModal.vue
@@ -100,7 +100,7 @@ const hue = ref(0),
const selectedWheelColor = ref('#FF0000');
const cursorPosition = ref({ x: 150, y: 75 });
-const availableColors = ['primary', ...Array.from({ length: 8 }, (_, i) => getAppColor(i))];
+const availableColors = ['primary', ...Array.from({ length: 8 }, (_, i) => getAppAccent(i))];
const selectColor = (color: string) => {
props.onColorSelect(color);
diff --git a/frontend/app/components/Node/NodeList.vue b/frontend/app/components/Node/NodeList.vue
index 7ab460e4..1a970f71 100644
--- a/frontend/app/components/Node/NodeList.vue
+++ b/frontend/app/components/Node/NodeList.vue
@@ -2,7 +2,7 @@
<div class="card-component node-list">
<header>
<h1 v-if="parent">
- <Icon :name="parent.icon || 'files'" display="xl" :class="`parent-icon ${getAppColor(parent.color as number, true)}`" />
+ <Icon :name="parent.icon || 'files'" display="xl" :class="`parent-icon ${getAppAccent(parent.color as number, true)}`" />
{{ parent.name }}
</h1>
<h1 v-else-if="parentId === 'shared'">
@@ -85,7 +85,7 @@ const nodesStore = useNodesStore();
const router = useRouter();
const userStore = useUserStore();
const { isMobile } = useDevice();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const connectedId = userStore.user?.id;
const view = ref<ViewMode>();
diff --git a/frontend/app/components/NodeRecentCard.vue b/frontend/app/components/NodeRecentCard.vue
index 5a15f3a4..e4e113bc 100644
--- a/frontend/app/components/NodeRecentCard.vue
+++ b/frontend/app/components/NodeRecentCard.vue
@@ -1,7 +1,7 @@
<template>
<div class="card">
<div class="header">
- <Icon :name="icon" display="xl" :class="`node-icon ${getAppColor(node.color || category?.color as number, true)}`" />
+ <Icon :name="icon" display="xl" :class="`node-icon ${getAppAccent(node.color || category?.color as number, true)}`" />
<span class="time">{{ relativeTime(node.updated_timestamp) }}</span>
</div>
<h3 class="title">{{ node.name }}</h3>
@@ -26,7 +26,7 @@ const props = defineProps<{ node: Node }>();
const nodesStore = useNodesStore();
const { relativeTime } = useDateFormatters();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const category = nodesStore.getById(props.node.parent_id || '');
const icon = resolveIcon(props.node);
diff --git a/frontend/app/components/NodeWorkspaceCard.vue b/frontend/app/components/NodeWorkspaceCard.vue
index 5309cb1b..540548ed 100644
--- a/frontend/app/components/NodeWorkspaceCard.vue
+++ b/frontend/app/components/NodeWorkspaceCard.vue
@@ -1,5 +1,5 @@
<template>
- <div class="card" :class="getAppColor(workspace.color as number, true)">
+ <div class="card" :class="getAppAccent(workspace.color as number, true)">
<div class="header">
<span class="title">
<Icon :name="workspace.icon || 'workspace'" class="icon" />
@@ -25,7 +25,7 @@ defineProps<{ workspace: Node }>();
const nodesStore = useNodesStore();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
// Get workspace categories
const getWorkspaceCategories = (workspaceId: string) => {
diff --git a/frontend/app/components/Sidebar/SidebarItem.vue b/frontend/app/components/Sidebar/SidebarItem.vue
index 04b0e70f..ad1af5b7 100644
--- a/frontend/app/components/Sidebar/SidebarItem.vue
+++ b/frontend/app/components/Sidebar/SidebarItem.vue
@@ -35,7 +35,7 @@ import type { Node } from '~/stores';
const nodesStore = useNodesStore();
const { isOpened, workspaceId } = useSidebar();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
const { isMobile } = useDevice();
const props = defineProps<{ item: Item | DefaultItem; level: number }>();
@@ -43,7 +43,7 @@ const isDragOver = ref<boolean>(false);
const customClass = computed(() => {
if ('color' in props.item.data && props.item.data.color != null && props.item.data.color != -1)
- return `item-icon ${getAppColor(props.item.data.color as number)}`;
+ return `item-icon ${getAppAccent(props.item.data.color as number)}`;
return 'default-icon';
});
const icon = computed(() => {
diff --git a/frontend/app/components/Sidebar/SidebarWorkspace.vue b/frontend/app/components/Sidebar/SidebarWorkspace.vue
index a7db5fea..afdd2bbe 100644
--- a/frontend/app/components/Sidebar/SidebarWorkspace.vue
+++ b/frontend/app/components/Sidebar/SidebarWorkspace.vue
@@ -1,7 +1,7 @@
<template>
<div class="workspace-item">
<span class="workspace-name">
- <Icon :name="option.meta?.icon || 'workspace'" size="22" :class="[getAppColor(option.meta?.color), 'icon']" />
+ <Icon :name="option.meta?.icon || 'workspace'" size="22" :class="[getAppAccent(option.meta?.color), 'icon']" />
{{ option.text }}
</span>
<span>
@@ -15,7 +15,7 @@ import type { Workspace } from './helpers';
defineProps<{ option: Workspace }>();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
</script>
<style scoped lang="scss">
diff --git a/frontend/app/composables/useAppColors.ts b/frontend/app/composables/useAppColors.ts
index 11f91884..ad6c38ed 100644
--- a/frontend/app/composables/useAppColors.ts
+++ b/frontend/app/composables/useAppColors.ts
@@ -1,7 +1,7 @@
import { appColors } from '~/helpers/constants';
/** Get theme color name by index (-2 = primary, -1 = none, 0+ = color index) */
-function getAppColor(index: number = 0, defaultPrimary?: boolean): string {
+function getAppAccent(index: number = 0, defaultPrimary?: boolean): string {
if ((defaultPrimary && index < 0) || index == -2) return 'primary';
if (index == -1) return '';
return appColors[index % appColors.length] || 'primary';
@@ -10,7 +10,7 @@ function getAppColor(index: number = 0, defaultPrimary?: boolean): string {
/** Apply a theme color to CSS custom properties */
function setAppColor(color: string | number) {
if (typeof color === 'number') {
- color = getAppColor(color);
+ color = getAppAccent(color);
}
if (color === 'primary') color = 'default';
document.documentElement.style.setProperty('--primary', `var(--${color})`);
@@ -25,7 +25,7 @@ function setAppColor(color: string | number) {
export const useAppColors = () => {
return {
- getAppColor,
+ getAppAccent,
setAppColor,
};
};
diff --git a/frontend/app/pages/dashboard/cdn/index.vue b/frontend/app/pages/dashboard/cdn/index.vue
index 44b1be37..41ff3dc9 100644
--- a/frontend/app/pages/dashboard/cdn/index.vue
+++ b/frontend/app/pages/dashboard/cdn/index.vue
@@ -166,7 +166,7 @@ const rows: ComputedRef<Field[]> = computed(() =>
name: { content: res.name, type: 'text' },
size: { content: readableFileSize(res.size ?? 0), type: 'text' },
type: { content: `<tag class="${color(res.metadata?.filetype as string)}">${res.metadata?.filetype as string}</tag>`, type: 'html' },
- parent: { content: category ? `<tag class="${appColors.getAppColor(category.color)}">${parent?.name}</tag>` : '', type: 'html' },
+ parent: { content: category ? `<tag class="${appColors.getAppAccent(category.color)}">${parent?.name}</tag>` : '', type: 'html' },
date: { content: numericDate(res.created_timestamp), type: 'text' },
action: { type: 'slot', data: res },
};
diff --git a/frontend/app/pages/dashboard/home.vue b/frontend/app/pages/dashboard/home.vue
index be99f822..7be3606c 100644
--- a/frontend/app/pages/dashboard/home.vue
+++ b/frontend/app/pages/dashboard/home.vue
@@ -30,7 +30,7 @@
<Transition name="dropdown">
<div v-if="searchResults?.length" class="search-results">
<NuxtLink v-for="result in searchResults" :key="result.id" class="search-result" :to="getNodeLink(result)">
- <Icon :name="resolveIcon(result)" :class="`node-icon ${getAppColor(result.color as number, true)}`" />
+ <Icon :name="resolveIcon(result)" :class="`node-icon ${getAppAccent(result.color as number, true)}`" />
<div class="result-content">
<span class="result-name">{{ result.name }}</span>
<span class="result-path">{{ getNodePath(result) }}</span>
@@ -93,7 +93,7 @@
<Icon
:name="resolveIcon(item)"
display="md"
- :class="`activity-icon ${getAppColor(item.color || getCategory(item.parent_id)?.color as number, true)}`"
+ :class="`activity-icon ${getAppAccent(item.color || getCategory(item.parent_id)?.color as number, true)}`"
/>
<div class="activity-content">
<span class="activity-name">{{ item.name }}</span>
@@ -149,7 +149,7 @@ const nodesStore = useNodesStore();
const userStore = useUserStore();
const { todayFormatted, formatTime, shortDateLabel } = useDateFormatters();
-const { getAppColor } = useAppColors();
+const { getAppAccent } = useAppColors();
// Search state
const searchQuery = ref('');
diff --git a/frontend/app/pages/dashboard/settings/_views/preferences.vue b/frontend/app/pages/dashboard/settings/_views/preferences.vue
index 5c53496c..c9084d29 100644
--- a/frontend/app/pages/dashboard/settings/_views/preferences.vue
+++ b/frontend/app/pages/dashboard/settings/_views/preferences.vue
@@ -91,7 +91,7 @@ const options: Array<{ label: string; options: InterfaceOption[] }> = [
},
},
{
- label: 'Choose primary color',
+ label: 'Choose accent color',
type: 'color',
key: 'primaryColor',
// @ts-expect-error -> specific type