Skip to content

Modern Docker Management, Designed for Everyone

feat: customizable accent color (#678)

Kyle Mendell2ef033f46647
diff --git a/backend/internal/bootstrap/services_bootstrap.go b/backend/internal/bootstrap/services_bootstrap.go
index c5e3033cb..565bf8f83 100644
--- a/backend/internal/bootstrap/services_bootstrap.go
+++ b/backend/internal/bootstrap/services_bootstrap.go
@@ -36,12 +36,12 @@ type Services struct {
func initializeServices(ctx context.Context, db *database.DB, cfg *config.Config, httpClient *http.Client) (svcs *Services, dockerSrvice *services.DockerClientService, err error) {
svcs = &Services{}
- svcs.AppImages = services.NewApplicationImagesService(resources.FS)
svcs.Event = services.NewEventService(db)
svcs.Settings, err = services.NewSettingsService(ctx, db)
if err != nil {
return nil, nil, fmt.Errorf("failed to settings service: %w", err)
}
+ svcs.AppImages = services.NewApplicationImagesService(resources.FS, svcs.Settings)
dockerClient := services.NewDockerClientService(db, cfg)
svcs.Docker = dockerClient
svcs.User = services.NewUserService(db)
diff --git a/backend/internal/dto/settings_dto.go b/backend/internal/dto/settings_dto.go
index 9840adf29..0abf67e75 100644
--- a/backend/internal/dto/settings_dto.go
+++ b/backend/internal/dto/settings_dto.go
@@ -24,6 +24,7 @@ type UpdateSettingsDto struct {
EnableGravatar *string `json:"enableGravatar,omitempty"`
DefaultShell *string `json:"defaultShell,omitempty"`
DockerHost *string `json:"dockerHost,omitempty"`
+ AccentColor *string `json:"accentColor,omitempty"`
// Authentication settings
AuthLocalEnabled *string `json:"authLocalEnabled,omitempty"`
diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.go
index 8cee4794f..9add983be 100644
--- a/backend/internal/models/settings.go
+++ b/backend/internal/models/settings.go
@@ -55,6 +55,7 @@ type Settings struct {
EnableGravatar SettingVariable `key:"enableGravatar"`
DefaultShell SettingVariable `key:"defaultShell"`
DockerHost SettingVariable `key:"dockerHost,public,envOverride"`
+ AccentColor SettingVariable `key:"accentColor,public"`
// Authentication
AuthLocalEnabled SettingVariable `key:"authLocalEnabled,public"`
diff --git a/backend/internal/services/app_images_service.go b/backend/internal/services/app_images_service.go
index 067ccb78a..53aac1f0d 100644
--- a/backend/internal/services/app_images_service.go
+++ b/backend/internal/services/app_images_service.go
@@ -12,15 +12,17 @@ import (
)
type ApplicationImagesService struct {
- mu sync.RWMutex
- imageData map[string][]byte
- mimeTypes map[string]string
+ mu sync.RWMutex
+ imageData map[string][]byte
+ mimeTypes map[string]string
+ settingsService *SettingsService
}
-func NewApplicationImagesService(embeddedFS embed.FS) *ApplicationImagesService {
+func NewApplicationImagesService(embeddedFS embed.FS, settingsService *SettingsService) *ApplicationImagesService {
service := &ApplicationImagesService{
- imageData: make(map[string][]byte),
- mimeTypes: make(map[string]string),
+ imageData: make(map[string][]byte),
+ mimeTypes: make(map[string]string),
+ settingsService: settingsService,
}
imageDir := "images"
@@ -58,13 +60,40 @@ func NewApplicationImagesService(embeddedFS embed.FS) *ApplicationImagesService
func (s *ApplicationImagesService) GetImage(name string) ([]byte, string, error) {
s.mu.RLock()
- defer s.mu.RUnlock()
-
data, ok := s.imageData[name]
+ mimeType := s.mimeTypes[name]
+ s.mu.RUnlock()
+
if !ok {
return nil, "", fmt.Errorf("image '%s' not found", name)
}
- mimeType := s.mimeTypes[name]
+ // Apply dynamic color replacement for logo SVGs
+ if (name == "logo" || name == "logo-full") && mimeType == "image/svg+xml" {
+ data = s.applyAccentColorToSVG(data)
+ }
+
return data, mimeType, nil
}
+
+func (s *ApplicationImagesService) applyAccentColorToSVG(svgData []byte) []byte {
+ // Get accent color from settings
+ cfg := s.settingsService.GetSettingsConfig()
+ if cfg == nil {
+ return svgData
+ }
+
+ accentColor := cfg.AccentColor.Value
+ if accentColor == "" || accentColor == "default" {
+ accentColor = "oklch(0.606 0.25 292.717)" // Default purple
+ }
+
+ // Replace the hardcoded purple color with the accent color
+ // The SVG uses .st0{fill:#6D28D9;} which we'll replace
+ svgStr := string(svgData)
+
+ // Replace hex color in style tag
+ svgStr = strings.ReplaceAll(svgStr, "fill:#6D28D9", fmt.Sprintf("fill:%s", accentColor))
+
+ return []byte(svgStr)
+}
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index 9e25bbdf3..9cb614303 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -98,6 +98,7 @@ func (s *SettingsService) getDefaultSettings() *models.Settings {
MobileNavigationShowLabels: models.SettingVariable{Value: "true"},
MobileNavigationScrollToHide: models.SettingVariable{Value: "true"},
MobileNavigationTapToHide: models.SettingVariable{Value: "false"},
+ AccentColor: models.SettingVariable{Value: "oklch(0.606 0.25 292.717)"},
InstanceID: models.SettingVariable{Value: ""},
}
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 7a7f3b8e4..016b0bb58 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1,6 +1,11 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"layout_title": "Arcane",
+ "accent_color": "Accent Color",
+ "accent_color_description": "Select an accent color to customize the appearance of Arcane",
+ "custom_accent_color": "Custom Accent Color",
+ "custom_accent_color_description": "Enter a custom color using valid CSS color formats (e.g., hex, rgb, hsl).",
+ "color_value": "Color value",
"error_occurred": "An Error Occured",
"error_not_found": "Not Found",
"error_generic": "Something went wrong",
@@ -1257,5 +1262,6 @@
"customize_registry_mirrors": "Registry Mirrors",
"customize_secret_variables": "Secret Variables",
"customize_variable_templates": "Variable Templates",
- "duplicate": "Duplicate"
+ "duplicate": "Duplicate",
+ "cancel": "Cancel"
}
diff --git a/frontend/src/lib/components/accent-color/accent-color-picker.svelte b/frontend/src/lib/components/accent-color/accent-color-picker.svelte
new file mode 100644
index 000000000..fdc1af1c9
--- /dev/null
+++ b/frontend/src/lib/components/accent-color/accent-color-picker.svelte
@@ -0,0 +1,98 @@
+<script lang="ts">
+ import { Label } from '$lib/components/ui/label/index.js';
+ import * as RadioGroup from '$lib/components/ui/radio-group/index.js';
+ import { applyAccentColor } from '$lib/utils/accent-color-util';
+ import { Check, Plus } from '@lucide/svelte';
+ import CustomColorDialog from './custom-color.svelte';
+
+ let {
+ selectedColor = $bindable(),
+ previousColor,
+ disabled = false
+ }: { selectedColor: string; previousColor: string; disabled?: boolean } = $props();
+ let showCustomColorDialog = $state(false);
+
+ const accentColors = [
+ { label: 'Default', color: 'oklch(0.606 0.25 292.717)' },
+ { label: 'Rose', color: 'oklch(0.63 0.2 15)' },
+ { label: 'Orange', color: 'oklch(0.68 0.2 50)' },
+ { label: 'Amber', color: 'oklch(0.75 0.18 80)' },
+ { label: 'Green', color: 'oklch(0.65 0.2 150)' },
+ { label: 'Teal', color: 'oklch(0.6 0.15 180)' },
+ { label: 'Blue', color: 'oklch(0.6 0.2 240)' }
+ ];
+
+ // Check if current accent color is a custom color (not in predefined list)
+ let isCustomColor = $derived(!accentColors.some((c) => c.color === selectedColor));
+ let isPreviousColorCustom = $derived(!accentColors.some((c) => c.color === previousColor));
+
+ function handleAccentColorChange(accentValue: string) {
+ selectedColor = accentValue;
+ applyAccentColor(accentValue);
+ }
+</script>
+
+<RadioGroup.Root
+ class="flex flex-wrap gap-3"
+ value={isCustomColor ? 'custom' : selectedColor}
+ onValueChange={(value) => {
+ if (value != 'custom') {
+ handleAccentColorChange(value);
+ }
+ }}
+>
+ {#each accentColors as accent}
+ {@render colorOption(accent.label, accent.color, selectedColor === accent.color)}
+ {/each}
+ {#if isCustomColor || isPreviousColorCustom}
+ {@render colorOption('Custom', isCustomColor ? selectedColor : previousColor, isCustomColor)}
+ {/if}
+ {@render colorOption('Custom', 'custom', false, true)}
+</RadioGroup.Root>
+
+<CustomColorDialog bind:open={showCustomColorDialog} onApply={handleAccentColorChange} />
+
+{#snippet colorOption(label: string, color: string, isSelected: boolean, isCustomColorSelection = false)}
+ <div class="group/item relative">
+ <RadioGroup.Item id={color} value={color} class="sr-only" />
+ <Label
+ for={color}
+ class={{
+ 'cursor-pointer': !disabled,
+ 'cursor-not-allowed': disabled,
+ group: isCustomColorSelection
+ }}
+ onclick={() => {
+ if (isCustomColorSelection && !disabled) {
+ showCustomColorDialog = true;
+ }
+ }}
+ >
+ <div
+ class={{
+ 'relative z-10 size-8 rounded-full border-2 transition-all duration-200 ease-out group-hover/item:z-20 group-hover/item:scale-110': true,
+ 'bg-black dark:bg-white': color === 'default'
+ }}
+ style={color !== 'default' ? `background-color: ${color}` : ''}
+ title={label}
+ >
+ {#if isCustomColorSelection}
+ <div
+ class="bg-muted absolute inset-0 flex items-center justify-center rounded-full border-2 border-dashed border-gray-300"
+ >
+ <Plus class="text-muted-foreground size-4" />
+ </div>
+ {:else if isSelected}
+ <div class="absolute inset-0 flex items-center justify-center">
+ <Check class="size-4 text-white drop-shadow-sm" />
+ </div>
+ {/if}
+ </div>
+ <div
+ class="text-muted-foreground group-hover/item:text-foreground bg-background absolute left-1/2 top-12 z-20 max-w-0 -translate-x-1/2 transform overflow-hidden whitespace-nowrap rounded-md border px-2 py-1 text-xs opacity-0 shadow-sm transition-all duration-300 ease-out group-hover/item:max-w-[100px] group-hover/item:opacity-100"
+ >
+ {label}
+ </div>
+ </Label>
+ </div>
+{/snippet}
diff --git a/frontend/src/lib/components/accent-color/custom-color.svelte b/frontend/src/lib/components/accent-color/custom-color.svelte
new file mode 100644
index 000000000..984408ffa
--- /dev/null
+++ b/frontend/src/lib/components/accent-color/custom-color.svelte
@@ -0,0 +1,75 @@
+<script lang="ts">
+ import { Button } from '$lib/components/ui/button';
+ import * as Dialog from '$lib/components/ui/dialog';
+ import { Input } from '$lib/components/ui/input';
+ import { Label } from '$lib/components/ui/label/index.js';
+ import { m } from '$lib/paraglide/messages';
+ import { preventDefault } from '$lib/utils/form.utils';
+
+ let {
+ open = $bindable(false),
+ onApply
+ }: {
+ open: boolean;
+ onApply: (color: string) => void;
+ } = $props();
+
+ let customColorInput = $state('');
+
+ function applyCustomColor() {
+ if (!isValidColor(customColorInput)) return;
+ onApply(customColorInput);
+ open = false;
+ }
+
+ function isValidColor(color: string): boolean {
+ // Create a temporary element to test if the color is valid
+ const testElement = document.createElement('div');
+ testElement.style.color = color;
+ return testElement.style.color !== '';
+ }
+
+ function onOpenChange(newOpen: boolean) {
+ if (!newOpen) {
+ customColorInput = '';
+ }
+ open = newOpen;
+ }
+</script>
+
+<Dialog.Root {open} {onOpenChange}>
+ <Dialog.Content class="max-w-md">
+ <Dialog.Header>
+ <Dialog.Title class="flex items-center gap-2">{m.custom_accent_color()}</Dialog.Title>
+ <Dialog.Description>
+ {m.custom_accent_color_description()}
+ </Dialog.Description>
+ </Dialog.Header>
+
+ <form onsubmit={preventDefault(applyCustomColor)}>
+ <div class="space-y-4">
+ <div>
+ <Label for="custom-color-input" class="text-sm font-medium">{m.color_value()}</Label>
+ <div class="flex items-center gap-2">
+ <div class="w-full transition">
+ <Input id="custom-color-input" bind:value={customColorInput} placeholder="#3b82f6" class="mt-1 flex-1" />
+ </div>
+ <div
+ class={{
+ 'border-border border-1 mt-1 rounded-lg transition-all duration-200 ease-in-out': true,
+ 'h-9 w-9': isValidColor(customColorInput),
+ 'h-0 w-0': !isValidColor(customColorInput)
+ }}
+ style="background-color: {customColorInput}"
+ ></div>
+ </div>
+ </div>
+ </div>
+
+ <Dialog.Footer class="mt-6">
+ <Button variant="secondary" onclick={() => onOpenChange(false)}>{m.cancel()}</Button>
+ <Button type="submit" disabled={!customColorInput || !isValidColor(customColorInput)}>{m.apply()}</Button>
+ </Dialog.Footer>
+ </form>
+ </Dialog.Content>
+</Dialog.Root>
diff --git a/frontend/src/lib/components/quick-actions.svelte b/frontend/src/lib/components/quick-actions.svelte
index d9a881cc7..cad5c6ca7 100644
--- a/frontend/src/lib/components/quick-actions.svelte
+++ b/frontend/src/lib/components/quick-actions.svelte
@@ -109,15 +109,15 @@
</button>
<button
- class="ring-offset-background focus-visible:ring-ring bg-background/70 group inline-flex h-9 items-center gap-2 rounded-lg border border-violet-500/20 px-3 py-1.5 text-xs shadow-sm transition-colors hover:border-violet-500/40 hover:bg-violet-500/10 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
+ class="ring-offset-background focus-visible:ring-ring bg-background/70 border-primary/20 hover:border-primary/40 hover:bg-primary/10 group inline-flex h-9 items-center gap-2 rounded-lg border px-3 py-1.5 text-xs shadow-sm transition-colors hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60"
disabled={isLoading.starting || isLoading.stopping || isLoading.pruning || refreshing}
onclick={onRefresh}
aria-busy={refreshing}
>
{#if refreshing}
- <Spinner class="size-3.5 text-violet-500" />
+ <Spinner class="text-primary size-3.5" />
{:else}
- <RefreshCwIcon class="size-4 text-violet-500" />
+ <RefreshCwIcon class="text-primary size-4" />
{/if}
<span class="font-medium">{m.common_refresh()}</span>
</button>
diff --git a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
index 3bd326531..e3a87a1ab 100644
--- a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte
@@ -89,9 +89,7 @@
class="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
>
{#if currentSelectedEnvironment}
- <div
- class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"
- >
+ <div class="bg-primary text-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
{#if currentSelectedEnvironment.isLocal}
<ServerIcon class="size-4" />
{:else}
@@ -107,9 +105,7 @@
</span>
</div>
{:else}
- <div
- class="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"
- >
+ <div class="bg-primary text-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
<ServerIcon class="size-4" />
</div>
<div class="grid flex-1 text-left text-sm leading-tight">
@@ -161,13 +157,13 @@
<div
class={cn(
'flex size-6 items-center justify-center rounded-md border',
- isActive ? 'bg-sidebar-primary border-sidebar-primary' : 'border-border'
+ isActive ? 'bg-primary border-primary' : 'border-border'
)}
>
{#if env.isLocal}
- <ServerIcon class={cn('size-3.5 shrink-0', isActive && 'text-sidebar-primary-foreground')} />
+ <ServerIcon class={cn('size-3.5 shrink-0', isActive && 'text-primary-foreground')} />
{:else}
- <RouterIcon class={cn('size-3.5 shrink-0', isActive && 'text-sidebar-primary-foreground')} />
+ <RouterIcon class={cn('size-3.5 shrink-0', isActive && 'text-primary-foreground')} />
{/if}
</div>
<div class="flex flex-col">
diff --git a/frontend/src/lib/components/sidebar/sidebar-logo.svelte b/frontend/src/lib/components/sidebar/sidebar-logo.svelte
index 0453cd966..73378fbc0 100644
--- a/frontend/src/lib/components/sidebar/sidebar-logo.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-logo.svelte
@@ -3,8 +3,12 @@
import { cn } from '$lib/utils';
import { m } from '$lib/paraglide/messages';
import { getApplicationLogo } from '$lib/utils/image.util';
+ import settingsStore from '$lib/stores/config-store';
let { isCollapsed, versionInformation }: { isCollapsed: boolean; versionInformation: AppVersionInformation } = $props();
+
+ // Make logo URL reactive to accent color changes
+ let logoUrl = $derived(getApplicationLogo(!isCollapsed));
</script>
<div
@@ -20,7 +24,7 @@
)}
>
<img
- src={getApplicationLogo(!isCollapsed)}
+ src={logoUrl}
alt={m.layout_title()}
class={cn('drop-shadow-sm transition-all duration-300', isCollapsed ? 'h-6 w-6' : 'h-9 w-auto max-w-[160px]')}
width={isCollapsed ? '24' : '160'}
diff --git a/frontend/src/lib/components/ui/radio-group/index.ts b/frontend/src/lib/components/ui/radio-group/index.ts
new file mode 100644
index 000000000..90b33fe5b
--- /dev/null
+++ b/frontend/src/lib/components/ui/radio-group/index.ts
@@ -0,0 +1,10 @@
+import Root from "./radio-group.svelte";
+import Item from "./radio-group-item.svelte";
+
+export {
+ Root,
+ Item,
+ //
+ Root as RadioGroup,
+ Item as RadioGroupItem,
+};
diff --git a/frontend/src/lib/components/ui/radio-group/radio-group-item.svelte b/frontend/src/lib/components/ui/radio-group/radio-group-item.svelte
new file mode 100644
index 000000000..2cb0710b4
--- /dev/null
+++ b/frontend/src/lib/components/ui/radio-group/radio-group-item.svelte
@@ -0,0 +1,31 @@
+<script lang="ts">
+ import { RadioGroup as RadioGroupPrimitive } from "bits-ui";
+ import CircleIcon from "@lucide/svelte/icons/circle";
+ import { cn, type WithoutChildrenOrChild } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: WithoutChildrenOrChild<RadioGroupPrimitive.ItemProps> = $props();
+</script>
+
+<RadioGroupPrimitive.Item
+ bind:ref
+ data-slot="radio-group-item"
+ class={cn(
+ "border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 shadow-xs aspect-square size-4 shrink-0 rounded-full border outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ {...restProps}
+>
+ {#snippet children({ checked })}
+ <div data-slot="radio-group-indicator" class="relative flex items-center justify-center">
+ {#if checked}
+ <CircleIcon
+ class="fill-primary absolute left-1/2 top-1/2 size-2 -translate-x-1/2 -translate-y-1/2"
+ />
+ {/if}
+ </div>
+ {/snippet}
+</RadioGroupPrimitive.Item>
diff --git a/frontend/src/lib/components/ui/radio-group/radio-group.svelte b/frontend/src/lib/components/ui/radio-group/radio-group.svelte
new file mode 100644
index 000000000..da2912b04
--- /dev/null
+++ b/frontend/src/lib/components/ui/radio-group/radio-group.svelte
@@ -0,0 +1,19 @@
+<script lang="ts">
+ import { RadioGroup as RadioGroupPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ value = $bindable(""),
+ ...restProps
+ }: RadioGroupPrimitive.RootProps = $props();
+</script>
+
+<RadioGroupPrimitive.Root
+ bind:ref
+ bind:value
+ data-slot="radio-group"
+ class={cn("grid gap-3", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/stores/config-store.ts b/frontend/src/lib/stores/config-store.ts
index b13c1ed63..4d1d3f2ef 100644
--- a/frontend/src/lib/stores/config-store.ts
+++ b/frontend/src/lib/stores/config-store.ts
@@ -1,15 +1,17 @@
import { settingsService } from '$lib/services/settings-service';
import type { Settings } from '$lib/types/settings.type';
+import { applyAccentColor } from '$lib/utils/accent-color-util';
import { writable } from 'svelte/store';
const settingsStore = writable<Settings>();
const reload = async () => {
const settings = await settingsService.getSettings();
- settingsStore.set(settings);
+ set(settings);
};
const set = (settings: Settings) => {
+ applyAccentColor(settings.accentColor);
settingsStore.set(settings);
};
diff --git a/frontend/src/lib/types/settings.type.ts b/frontend/src/lib/types/settings.type.ts
index 9d173e16d..5688651e1 100644
--- a/frontend/src/lib/types/settings.type.ts
+++ b/frontend/src/lib/types/settings.type.ts
@@ -20,6 +20,7 @@ export type Settings = {
uiConfigDisabled: boolean;
defaultShell: string;
dockerHost: string;
+ accentColor: string;
authLocalEnabled: boolean;
authOidcEnabled: boolean;
diff --git a/frontend/src/lib/utils/accent-color-util.ts b/frontend/src/lib/utils/accent-color-util.ts
new file mode 100644
index 000000000..775618f8e
--- /dev/null
+++ b/frontend/src/lib/utils/accent-color-util.ts
@@ -0,0 +1,58 @@
+export function applyAccentColor(accentValue: string) {
+ if (accentValue === 'default') {
+ document.documentElement.style.removeProperty('--primary');
+ document.documentElement.style.removeProperty('--primary-foreground');
+ document.documentElement.style.removeProperty('--ring');
+ document.documentElement.style.removeProperty('--sidebar-ring');
+ return;
+ }
+
+ document.documentElement.style.setProperty('--primary', accentValue);
+
+ // Smart foreground color selection based on brightness
+ const foregroundColor = getContrastingForeground(accentValue);
+ document.documentElement.style.setProperty('--primary-foreground', foregroundColor);
+
+ // Create proper ring colors based on input format
+ const ringColor = `color-mix(in srgb, ${accentValue} 50%, transparent)`;
+ document.documentElement.style.setProperty('--ring', ringColor);
+ document.documentElement.style.setProperty('--sidebar-ring', ringColor);
+}
+
+function getContrastingForeground(color: string): string {
+ const brightness = getColorBrightness(color);
+
+ // Use white text for dark colors, black text for light colors
+ return brightness < 0.55 ? 'oklch(0.98 0 0)' : 'oklch(0.09 0 0)';
+}
+
+function getColorBrightness(color: string): number {
+ // Create a temporary element to get computed color
+ const tempElement = document.createElement('div');
+ tempElement.style.color = color;
+ document.body.appendChild(tempElement);
+
+ const computedColor = window.getComputedStyle(tempElement).color;
+ document.body.removeChild(tempElement);
+
+ // Parse RGB values from computed color
+ const rgbMatch = computedColor.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
+ if (!rgbMatch) {
+ // Fallback: assume medium brightness
+ return 0.5;
+ }
+
+ const [, r, g, b] = rgbMatch.map(Number);
+
+ // Calculate relative luminance using the standard formula
+ // https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html
+ const sR = r / 255;
+ const sG = g / 255;
+ const sB = b / 255;
+
+ const rLinear = sR <= 0.03928 ? sR / 12.92 : Math.pow((sR + 0.055) / 1.055, 2.4);
+ const gLinear = sG <= 0.03928 ? sG / 12.92 : Math.pow((sG + 0.055) / 1.055, 2.4);
+ const bLinear = sB <= 0.03928 ? sB / 12.92 : Math.pow((sB + 0.055) / 1.055, 2.4);
+
+ return 0.2126 * rLinear + 0.7152 * gLinear + 0.0722 * bLinear;
+}
diff --git a/frontend/src/lib/utils/image.util.ts b/frontend/src/lib/utils/image.util.ts
index 2950c6547..2653a6006 100644
--- a/frontend/src/lib/utils/image.util.ts
+++ b/frontend/src/lib/utils/image.util.ts
@@ -1,10 +1,20 @@
+import settingsStore from '$lib/stores/config-store';
+import { get } from 'svelte/store';
+
type SkipCacheUntil = {
[key: string]: number;
};
export function getApplicationLogo(full = false): string {
- const url = full ? '/api/app-images/logo?full=true' : '/api/app-images/logo';
- return getCachedImageUrl(url);
+ const settings = get(settingsStore);
+ const accentColor = settings?.accentColor || 'default';
+
+ // Add accent color as query param to bust cache when color changes
+ const baseUrl = full ? '/api/app-images/logo?full=true' : '/api/app-images/logo';
+ const separator = full ? '&' : '?';
+ const urlWithColor = `${baseUrl}${separator}color=${encodeURIComponent(accentColor)}`;
+
+ return getCachedImageUrl(urlWithColor);
}
export function getDefaultProfilePicture(): string {
return getCachedImageUrl('/api/app-images/profile');
diff --git a/frontend/src/routes/auth/login/+page.svelte b/frontend/src/routes/auth/login/+page.svelte
index ea36d8cae..42a6cdb2e 100644
--- a/frontend/src/routes/auth/login/+page.svelte
+++ b/frontend/src/routes/auth/login/+page.svelte
@@ -24,6 +24,9 @@
let username = $state('');
let password = $state('');
+ // Make logo URL reactive to accent color changes
+ let logoUrl = $derived(getApplicationLogo());
+
const oidcEnabledBySettings = data.settings?.authOidcEnabled === true;
const showOidcLoginButton = $derived(oidcEnabledBySettings);
@@ -203,7 +206,7 @@
>
<div class="space-y-4 p-8 text-center">
<div class="mb-8">
- <img class="mx-auto h-32 w-auto opacity-60" src={getApplicationLogo()} alt={m.layout_title()} />
+ <img class="mx-auto h-32 w-auto opacity-60" src={logoUrl} alt={m.layout_title()} />
</div>
<h2 class="text-foreground/80 text-2xl font-bold">{m.layout_title()}</h2>
<p class="text-muted-foreground max-w-xs text-balance">{m.auth_tagline()}</p>
diff --git a/frontend/src/routes/onboarding/+layout.svelte b/frontend/src/routes/onboarding/+layout.svelte
index 38d48f4ad..c6ec57651 100644
--- a/frontend/src/routes/onboarding/+layout.svelte
+++ b/frontend/src/routes/onboarding/+layout.svelte
@@ -10,6 +10,9 @@
let { children } = $props();
+ // Make logo URL reactive to accent color changes
+ let logoUrl = $derived(getApplicationLogo());
+
const steps = [
{ id: 'welcome', label: 'Welcome', path: '/onboarding/welcome', icon: CircleCheckIcon },
{ id: 'password', label: 'Admin Password', path: '/onboarding/password', icon: KeyIcon },
@@ -25,7 +28,7 @@
<div class="flex min-h-screen flex-col">
<header class="border-b px-8 py-8">
<div class="flex items-center">
- <img src={getApplicationLogo()} alt="Arcane" class="size-12" />
+ <img src={logoUrl} alt="Arcane" class="size-12" />
<h1 class="ml-4 text-2xl font-bold">Arcane Setup</h1>
</div>
</header>
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index 44b746e61..0761f21d7 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -9,14 +9,20 @@
import { m } from '$lib/paraglide/messages';
import FolderIcon from '@lucide/svelte/icons/folder';
import UserIcon from '@lucide/svelte/icons/user';
+ import PaletteIcon from '@lucide/svelte/icons/palette';
import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
import settingsStore from '$lib/stores/config-store';
import SettingsIcon from '@lucide/svelte/icons/settings';
import { settingsService } from '$lib/services/settings-service';
import { SettingsPageLayout } from '$lib/layouts';
+ import AccentColorPicker from '$lib/components/accent-color/accent-color-picker.svelte';
+ import { Label } from '$lib/components/ui/label/index.js';
let { data } = $props();
- let currentSettings = $state(data.settings);
+ let currentSettings = $state({
+ ...data.settings,
+ accentColor: data.settings.accentColor || 'default'
+ });
let hasChanges = $state(false);
let isLoading = $state(false);
@@ -25,7 +31,8 @@
const formSchema = z.object({
projectsDirectory: z.string().min(1, m.general_projects_directory_required()),
baseServerUrl: z.string().min(1, m.general_base_url_required()),
- enableGravatar: z.boolean()
+ enableGravatar: z.boolean(),
+ accentColor: z.string()
});
let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));
@@ -34,7 +41,8 @@
() =>
$formInputs.projectsDirectory.value !== currentSettings.projectsDirectory ||
$formInputs.baseServerUrl.value !== currentSettings.baseServerUrl ||
- $formInputs.enableGravatar.value !== currentSettings.enableGravatar
+ $formInputs.enableGravatar.value !== currentSettings.enableGravatar ||
+ $formInputs.accentColor.value !== currentSettings.accentColor
);
$effect(() => {
@@ -78,6 +86,7 @@
$formInputs.projectsDirectory.value = currentSettings.projectsDirectory;
$formInputs.baseServerUrl.value = currentSettings.baseServerUrl;
$formInputs.enableGravatar.value = currentSettings.enableGravatar;
+ $formInputs.accentColor.value = currentSettings.accentColor;
}
onMount(() => {
@@ -142,6 +151,24 @@
/>
</Card.Content>
</Card.Root>
+
+ <Card.Root>
+ <Card.Header icon={PaletteIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.accent_color()}</Card.Title>
+ <Card.Description>{m.accent_color_description()}</Card.Description>
+ </div>
+ </Card.Header>
+ <Card.Content class="px-3 py-4 sm:px-6">
+ <div class="space-y-5">
+ <AccentColorPicker
+ previousColor={currentSettings.accentColor}
+ bind:selectedColor={$formInputs.accentColor.value}
+ disabled={isReadOnly}
+ />
+ </div>
+ </Card.Content>
+ </Card.Root>
</div>
</fieldset>
{/snippet}