Skip to content

Commit

Permalink
chore: replace colors by using registry colors in service, task-manag…
Browse files Browse the repository at this point in the history
…er, troubleshooting, and window-control-buttons (podman-desktop#9427)

* chore: change hardcoded colors to color registry
Signed-off-by: Sonia Sandler <[email protected]>
  • Loading branch information
SoniaSandler authored Nov 11, 2024
1 parent 5240ef8 commit 153930c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 16 deletions.
21 changes: 21 additions & 0 deletions packages/main/src/plugin/color-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ export class ColorRegistry {
light: colorPalette.purple[900],
});

this.registerColor('titlebar-hover-bg', {
dark: colorPalette.charcoal[300],
light: colorPalette.gray[300],
});

this.registerColor('titlebar-windows-hover-exit-bg', {
dark: '#c42b1c',
light: '#c42b1c',
Expand Down Expand Up @@ -1465,5 +1470,21 @@ export class ColorRegistry {
dark: colorPalette.white,
light: colorPalette.white,
});
this.registerColor(`${badge}sky`, {
dark: colorPalette.sky[500],
light: colorPalette.sky[500],
});
this.registerColor(`${badge}purple`, {
dark: colorPalette.purple[500],
light: colorPalette.purple[500],
});
this.registerColor(`${badge}fuschia`, {
dark: colorPalette.fuschia[600],
light: colorPalette.fuschia[600],
});
this.registerColor(`${badge}gray`, {
dark: colorPalette.gray[600],
light: colorPalette.gray[600],
});
}
}
8 changes: 4 additions & 4 deletions packages/renderer/src/lib/service/ServiceColumnType.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('Expect basic column styling', async () => {

const dot = text.parentElement?.children[0];
expect(dot).toBeInTheDocument();
expect(dot).toHaveClass('text-gray-600');
expect(dot).toHaveClass('text-[var(--pd-badge-gray)]');
result.unmount();
});

Expand All @@ -56,7 +56,7 @@ test('Expect column styling ClusterIP', async () => {

const dot = text.parentElement?.children[0];
expect(dot).toBeInTheDocument();
expect(dot).toHaveClass('text-sky-500');
expect(dot).toHaveClass('text-[var(--pd-badge-sky)]');
});

test('Expect column styling LoadBalancer', async () => {
Expand All @@ -68,7 +68,7 @@ test('Expect column styling LoadBalancer', async () => {

const dot = text.parentElement?.children[0];
expect(dot).toBeInTheDocument();
expect(dot).toHaveClass('text-purple-500');
expect(dot).toHaveClass('text-[var(--pd-badge-purple)]');
});

test('Expect column styling NodePort', async () => {
Expand All @@ -80,5 +80,5 @@ test('Expect column styling NodePort', async () => {

const dot = text.parentElement?.children[0];
expect(dot).toBeInTheDocument();
expect(dot).toHaveClass('text-fuschia-600');
expect(dot).toHaveClass('text-[var(--pd-badge-fuschia)]');
});
8 changes: 4 additions & 4 deletions packages/renderer/src/lib/service/ServiceColumnType.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ function getTypeAttributes(type: string) {
switch (type) {
case 'ClusterIP':
// faNetworkWired: Represents internal network connections, suitable for ClusterIP
return { color: 'text-sky-500', icon: faNetworkWired };
return { color: 'text-[var(--pd-badge-sky)]', icon: faNetworkWired };
case 'LoadBalancer':
// faBalanceScale: Symbolizes distribution, fitting for LoadBalancer that distributes traffic
return { color: 'text-purple-500', icon: faBalanceScale };
return { color: 'text-[var(--pd-badge-purple)]', icon: faBalanceScale };
case 'NodePort':
// faPlug: Indicates a connection point, appropriate for NodePort which exposes services on each Node's IP
return { color: 'text-fuschia-600', icon: faPlug };
return { color: 'text-[var(--pd-badge-fuschia)]', icon: faPlug };
default:
// faQuestionCircle: Used for unknown or unspecified types
return { color: 'text-gray-600', icon: faQuestionCircle };
return { color: 'text-[var(--pd-badge-gray)]', icon: faQuestionCircle };
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer/src/lib/service/ServiceDetails.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function loadDetails() {
<svelte:fragment slot="actions">
<ServiceActions service={service} detailed={true} on:update={() => (service = service)} />
</svelte:fragment>
<div slot="detail" class="flex py-2 w-full justify-end text-sm text-gray-700">
<div slot="detail" class="flex py-2 w-full justify-end text-sm text-[var(--pd-content-text)]">
<StateChange state={service.status} />
</div>
<svelte:fragment slot="tabs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ basic information -->
<KubeServiceArtifact serviceName={service.metadata?.name} namespace={service.metadata?.namespace} artifact={service.spec} />
<KubeEventsArtifact events={events} />
{:else}
<p class="text-purple-500 font-medium">Loading ...</p>
<p class="text-[var(--pd-state-info)] font-medium">Loading ...</p>
{/if}
</Table>
6 changes: 3 additions & 3 deletions packages/renderer/src/lib/task-manager/ProgressBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ export let height: string = 'h-4';
</script>

<div class="flex flex-row">
<div class="{width} {height} rounded-full bg-gray-900 progress-bar overflow-hidden">
<div class="{width} {height} rounded-full bg-[var(--pd-progressBar-bg)] progress-bar overflow-hidden">
{#if progress !== undefined}
<div
class="{width} {height} bg-purple-600 rounded-full progress-bar-incremental"
class="{width} {height} bg-[var(--pd-progressBar-in-progress-bg)] rounded-full progress-bar-incremental"
role="progressbar"
style="width:{progress}%">
</div>
{:else}
<div class="{width} {height} bg-purple-600 rounded-full progress-bar-indeterminate" role="progressbar"></div>
<div class="{width} {height} bg-[var(--pd-progressBar-in-progress-bg)] rounded-full progress-bar-indeterminate" role="progressbar"></div>
{/if}
</div>
{#if progress !== undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ async function fetch(): Promise<void> {
{/each}
</ul>
{:else}
<div class="h-32 flex flex-row mx-auto text-xs text-gray-800 text-center">No buffer events</div>
<div class="h-32 flex flex-row mx-auto text-xs text-[var(--pd-content-text)] text-center">No buffer events</div>
{/if}
</div>
</div>

<div class="text-xs text-gray-800 mt-2 text-center">Track events that have updated the store</div>
<div class="text-xs text-[var(--pd-content-text)] mt-2 text-center">Track events that have updated the store</div>
</div>
</div>
<svelte:fragment slot="buttons">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ onMount(() => {
on:click={() => action()}
title={titleName}
aria-label={name}
class="h-[25px] w-[25px] cursor-pointer text-gray-400 hover:rounded-full hover:bg-charcoal-300 flex place-items-center justify-center">
class="h-[25px] w-[25px] cursor-pointer text-[var(--pd-titlebar-text)] hover:rounded-full hover:bg-[var(--pd-titlebar-hover-bg)] flex place-items-center justify-center">
<Fa size={iconSize} icon={icon} />
</button>

0 comments on commit 153930c

Please sign in to comment.