Skip to content

Build your personal knowledge base with Trilium Notes

feat(views/table): support color class for title

Elian Doran7a131e0bcc75
diff --git a/apps/client/src/widgets/view_widgets/table_view/formatters.ts b/apps/client/src/widgets/view_widgets/table_view/formatters.ts
index ea2d6d07b5..a333742e9a 100644
--- a/apps/client/src/widgets/view_widgets/table_view/formatters.ts
+++ b/apps/client/src/widgets/view_widgets/table_view/formatters.ts
@@ -51,12 +51,12 @@ export function NoteFormatter(cell: CellComponent, _formatterParams, onRendered)
* Custom formatter for the note title that is quite similar to {@link NoteFormatter}, but where the title and icons are read from separate fields.
*/
export function NoteTitleFormatter(cell: CellComponent) {
- const { noteId, iconClass } = cell.getRow().getData();
+ const { noteId, iconClass, colorClass } = cell.getRow().getData();
if (!noteId) {
return "";
}
- const { $noteRef } = buildNoteLink(noteId, cell.getValue(), iconClass);
+ const { $noteRef } = buildNoteLink(noteId, cell.getValue(), iconClass, colorClass);
return $noteRef[0].outerHTML;
}
diff --git a/apps/client/src/widgets/view_widgets/table_view/rows.ts b/apps/client/src/widgets/view_widgets/table_view/rows.ts
index a3efca0c66..460f169acb 100644
--- a/apps/client/src/widgets/view_widgets/table_view/rows.ts
+++ b/apps/client/src/widgets/view_widgets/table_view/rows.ts
@@ -9,6 +9,7 @@ export type TableData = {
labels: Record<string, boolean | string | null>;
relations: Record<string, boolean | string | null>;
branchId: string;
+ colorClass: string | undefined;
_children?: TableData[];
};
@@ -41,6 +42,7 @@ export async function buildRowDefinitions(parentNote: FNote, infos: AttributeDef
labels,
relations,
branchId: branch.branchId,
+ colorClass: note.getColorClass()
}
if (note.hasChildren() && (maxDepth < 0 || currentDepth < maxDepth)) {