Skip to content

Commit 3d79c2f

Browse files
committed
fix: use colorbrewer theme for status
this also updates the utilization grids; rearrange into cpu, gpu, mem, gpumem, and keep some color correspondence between cpu-mem and gpu-gpumem
1 parent bf8d1f5 commit 3d79c2f

File tree

5 files changed

+54
-71
lines changed

5 files changed

+54
-71
lines changed

plugins/plugin-codeflare-dashboard/src/controller/dashboard/grids.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export type SupportedGrid = "status" | SupportedUtilizationGrid
2323

2424
export const defaultUtilizationThemes: Record<SupportedUtilizationGrid, ValidUtilizationTheme> = {
2525
"cpu%": "rain",
26-
"mem%": "purple",
27-
"gpu%": "red",
26+
"mem%": "green",
27+
"gpu%": "purple",
2828
"gpumem%": "magenta",
2929
}
3030

plugins/plugin-codeflare-dashboard/src/controller/dashboard/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default async function dashboard(args: Arguments<Options>, cmd: "db" | "d
9999
const gridFor = async (kind: SupportedGrid): Promise<GridSpec> => {
100100
const tails = await tailf(kind, profile, jobId)
101101
return kind === "status"
102-
? status(tails, { demo, theme, themeDefault: "patternfly" })
102+
? status(tails, { demo, theme, themeDefault: "colorbrewer" })
103103
: utilization(kind, tails, { demo, theme })
104104
}
105105

@@ -109,8 +109,8 @@ export default async function dashboard(args: Arguments<Options>, cmd: "db" | "d
109109
gridFor("status"),
110110
null, // newline
111111
gridFor("cpu%"),
112-
gridFor("mem%"),
113112
gridFor("gpu%"),
113+
gridFor("mem%"),
114114
gridFor("gpumem%"),
115115
])
116116
} else if (isSupportedGrid(kind)) {

plugins/plugin-codeflare-dashboard/src/controller/dashboard/status.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,12 @@ export default function statusDashboard(
265265
const theme = statusThemes[themeS]
266266

267267
const styleOf: Record<WorkerState, TextProps> = {
268-
Queued: theme.gray,
269-
Provisioning: theme.magenta,
270-
Initializing: theme.lightBlue,
271-
Running: theme.lightGreen,
272-
Success: theme.green,
273-
Failed: theme.red,
268+
Queued: theme[0],
269+
Provisioning: theme[1],
270+
Initializing: theme[2],
271+
Running: theme[3],
272+
Success: theme[4],
273+
Failed: theme[5],
274274
}
275275

276276
const initWatcher = (cb: OnData) => {

plugins/plugin-codeflare-dashboard/src/controller/dashboard/themes/status.ts

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,56 @@
1616

1717
import type { TextProps } from "ink"
1818

19-
type StatusThemeColor =
20-
| "gray"
21-
| "white"
22-
| "lightYellow"
23-
| "yellow"
24-
| "lightBlue"
25-
| "red"
26-
| "blue"
27-
| "magenta"
28-
| "lightGreen"
29-
| "green"
19+
export type StatusTheme = [TextProps, TextProps, TextProps, TextProps, TextProps, TextProps]
3020

31-
export type StatusTheme = Record<StatusThemeColor, TextProps>
21+
/** This uses the user's terminal colors */
22+
export const user: StatusTheme = [
23+
{ color: "gray" },
24+
{ color: "magenta" },
25+
{ color: "blue" },
26+
{ color: "green", dimColor: true },
27+
{ color: "green" },
28+
{ color: "red" },
29+
]
3230

33-
export const defaultStatusTheme: StatusTheme = {
34-
gray: { color: "gray" },
35-
white: { color: "white", dimColor: true },
36-
lightYellow: { color: "yellow", dimColor: true },
37-
yellow: { color: "yellow" },
38-
lightBlue: { color: "blue" },
39-
red: { color: "red" },
40-
blue: { color: "cyan" },
41-
magenta: { color: "magenta" },
42-
lightGreen: { color: "green", dimColor: true },
43-
green: { color: "green" },
44-
}
31+
export const carbon: StatusTheme = [
32+
{ color: "#8d8d8d" }, // gray50
33+
{ color: "#d4bbff" }, // purple30
34+
{ color: "#0072c3" }, // cyan50
35+
{ color: "#6fdc8c" }, // green30
36+
{ color: "#198038" }, // green60
37+
{ color: "#fa4d56" }, // red50
38+
]
4539

46-
export const carbonStatusTheme: StatusTheme = {
47-
gray: { color: "#8d8d8d" }, // gray50
48-
white: { color: "#ff832b" }, // orange40
49-
lightYellow: { color: "#fddc69" }, // yellow20
50-
yellow: { color: "#8e6a00" }, // yellow60
51-
lightBlue: { color: "#82cfff" }, // cyan30
52-
red: { color: "#fa4d56" }, // red50
53-
blue: { color: "#0072c3" }, // cyan50
54-
magenta: { color: "#d4bbff" }, // purple30
55-
lightGreen: { color: "#6fdc8c" }, // green30
56-
green: { color: "#198038" }, // green60
57-
}
40+
export const patternfly: StatusTheme = [
41+
{ color: "#B8BBBE" }, // black-400
42+
{ color: "#A18FFF" }, // purple-300
43+
{ color: "#2B9AF3" }, // blue-300
44+
{ color: "#C8EB79" }, // light-green-200
45+
{ color: "#5BA352" }, // green-400
46+
{ color: "#C9190B" }, // red-100
47+
]
5848

59-
export const patternflyStatusTheme: StatusTheme = {
60-
gray: { color: "#B8BBBE" }, // black-400
61-
white: { color: "#EC7A08" }, // orange-400
62-
lightYellow: { color: "#F9E0A2" }, // gold-100
63-
yellow: { color: "#C58C00" }, // gold-500
64-
lightBlue: { color: "#35CAED" }, // light-blue-300
65-
red: { color: "#C9190B" }, // red-100
66-
blue: { color: "#2B9AF3" }, // blue-300
67-
magenta: { color: "#A18FFF" }, // purple-300
68-
lightGreen: { color: "#C8EB79" }, // light-green-200
69-
green: { color: "#5BA352" }, // green-400
70-
}
49+
/** https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=8 */
50+
export const colorbrewer: StatusTheme = [
51+
{ color: "#fddbc7" },
52+
{ color: "#ef8a62" },
53+
{ color: "#d1e5f0" },
54+
{ color: "#67a9cf" },
55+
{ color: "#2166ac" },
56+
{ color: "#b2182b" },
57+
/* { color: "#5e4fa2" },
58+
{ color: "#3288bd" },
59+
{ color: "#e6f598" },
60+
{ color: "#66c2a5" },
61+
{ color: "#d53e4f" },*/
62+
]
7163

7264
export const statusThemes = {
73-
user: defaultStatusTheme,
74-
carbon: carbonStatusTheme,
75-
patternfly: patternflyStatusTheme,
65+
user,
66+
carbon,
67+
patternfly,
68+
colorbrewer,
7669
}
7770

7871
export type ValidTheme = keyof typeof statusThemes

plugins/plugin-codeflare-dashboard/src/controller/dashboard/themes/utilization.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ export const purple: Theme = [
3636
{ color: "#810f7c" },
3737
]
3838

39-
/*
40-
export const magenta: Theme = [
41-
{ color: "#" },
42-
{ color: "#" },
43-
{ color: "#" },
44-
{ color: "#" },
45-
{ color: "#" },
46-
]
47-
*/
48-
4939
export const magenta: Theme = [
5040
{ color: "#fcc5c0" },
5141
{ color: "#fa9fb5" },

0 commit comments

Comments
 (0)