diff --git a/frontend/src/layouts/AppLayout.vue b/frontend/src/layouts/AppLayout.vue index 67a32af..97ebf63 100644 --- a/frontend/src/layouts/AppLayout.vue +++ b/frontend/src/layouts/AppLayout.vue @@ -52,6 +52,25 @@ const handleCancel = () => { showDialog.value = false; resetForm(); } + +const getServerInitials = (name: string): string => { + if (!name) return '' + const words = name.trim().split(/\s+/) + if (words.length >= 2) { + return (words[0][0] + words[1][0]).toUpperCase() + } + return name.slice(0, 2).toUpperCase() +} + +const getServerColor = (str: string): string => { + if (!str) return 'hsl(0, 0%, 50%)' + let hash = 0 + for (let i = 0; i < str.length; i++) { + hash = str.charCodeAt(i) + ((hash << 5) - hash) + } + const hue = Math.abs(hash) % 360 + return `hsl(${hue}, 60%, 45%)` +}