@cyc-seattle/platform 1.45.0 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colors a program takes when it has none of its own: twelve hues a step apart, alternately darker and lighter so
|
|
3
|
+
* neighbors stay apart, each dark enough for white words on it at 4.5:1 (test/program-colors.test.ts).
|
|
4
|
+
*/
|
|
5
|
+
export declare const PROGRAM_PALETTE: readonly ["#a12628", "#ab5803", "#735603", "#548108", "#046c46", "#00837e", "#02657c", "#0274c7", "#4d49b1", "#8e51b6", "#912b76", "#b93f65"];
|
|
6
|
+
/** A program's color: its own, when the catalog sets one, or else one of the palette's, picked by its id. */
|
|
7
|
+
export declare function programColor(program: {
|
|
8
|
+
id: string;
|
|
9
|
+
color?: string | null;
|
|
10
|
+
}): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Each program's color on a calendar or a chart, so a program looks the same in every app.
|
|
2
|
+
/**
|
|
3
|
+
* The colors a program takes when it has none of its own: twelve hues a step apart, alternately darker and lighter so
|
|
4
|
+
* neighbors stay apart, each dark enough for white words on it at 4.5:1 (test/program-colors.test.ts).
|
|
5
|
+
*/
|
|
6
|
+
export const PROGRAM_PALETTE = [
|
|
7
|
+
"#a12628",
|
|
8
|
+
"#ab5803",
|
|
9
|
+
"#735603",
|
|
10
|
+
"#548108",
|
|
11
|
+
"#046c46",
|
|
12
|
+
"#00837e",
|
|
13
|
+
"#02657c",
|
|
14
|
+
"#0274c7",
|
|
15
|
+
"#4d49b1",
|
|
16
|
+
"#8e51b6",
|
|
17
|
+
"#912b76",
|
|
18
|
+
"#b93f65",
|
|
19
|
+
];
|
|
20
|
+
/** A 32-bit FNV-1a hash, so the same id picks the same color in every app and every load. */
|
|
21
|
+
function hash(text) {
|
|
22
|
+
let h = 0x811c9dc5;
|
|
23
|
+
for (let i = 0; i < text.length; i++) {
|
|
24
|
+
h ^= text.charCodeAt(i);
|
|
25
|
+
h = Math.imul(h, 0x01000193);
|
|
26
|
+
}
|
|
27
|
+
return h >>> 0;
|
|
28
|
+
}
|
|
29
|
+
/** A program's color: its own, when the catalog sets one, or else one of the palette's, picked by its id. */
|
|
30
|
+
export function programColor(program) {
|
|
31
|
+
return program.color || PROGRAM_PALETTE[hash(program.id) % PROGRAM_PALETTE.length];
|
|
32
|
+
}
|
package/dist/planning/index.d.ts
CHANGED
package/dist/planning/index.js
CHANGED
package/dist/schema/index.d.ts
CHANGED
|
@@ -1077,6 +1077,8 @@ export interface Programs {
|
|
|
1077
1077
|
product_id: string | Products;
|
|
1078
1078
|
/** A team, such as a race team. Families on a team see everyone on every team. */
|
|
1079
1079
|
team: boolean;
|
|
1080
|
+
/** The program's color on calendars and charts in Sail Team. Leave it empty and it gets one of its own. */
|
|
1081
|
+
color: string | null;
|
|
1080
1082
|
/** Who has a role in this program. */
|
|
1081
1083
|
role_assignments: (string | ProgramRoleAssignments)[];
|
|
1082
1084
|
/** The program's Google Group, if it has one. Most programs don't. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyc-seattle/platform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.0",
|
|
4
4
|
"description": "Pulumi components for CYC's shared Google Cloud platform: WebService, the platform outputs reader, and the stacks that build the platform",
|
|
5
5
|
"author": "CYC Community Sailing Center",
|
|
6
6
|
"license": "Apache-2.0",
|