Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit a42f3c3

Browse files
authored
Add support for specifying a favicon generation function in branding extension. (#52)
* Add branding extensions * prettier * Add favicon function extension. * lint * Update docs and types.
1 parent 877a5d7 commit a42f3c3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/lifecycles/BrandingExtensions.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ export interface AppTitleInRoom extends AppTitleBase {
2929
roomId: string;
3030
}
3131

32+
export interface GetFaviconParameters {
33+
// colour parameters
34+
bgColor: string;
35+
textColor: string;
36+
// font styling parameters
37+
fontFamily: string;
38+
fontWeight: "normal" | "italic" | "bold" | "bolder" | "lighter" | number;
39+
40+
// positioning parameters
41+
isUp: boolean;
42+
isLeft: boolean;
43+
}
44+
3245
export type AppTitleContext = AppTitleBase | AppTitleInRoom;
3346

3447
export interface ProvideBrandingExtensions {
@@ -38,10 +51,25 @@ export interface ProvideBrandingExtensions {
3851
* @returns A string to be used for the full title, or null to use the default title.
3952
*/
4053
getAppTitle(context: AppTitleContext): string | null;
54+
/**
55+
* Called when the app needs to generate the basic app favicon.
56+
* @returns A string URL for the icon, or null if no new icon should be generated.
57+
*/
58+
getFaviconSrc(): PromiseLike<string | null>;
59+
/**
60+
* Called when the app needs to generate a new "badge" favicon.
61+
* @param content The content inside the "badge".
62+
* @param opts Extra parameters for the badge.
63+
* @returns A string URL for the icon, or null if no new icon should be generated.
64+
*/
65+
getFaviconSrc(content: number | string, opts: GetFaviconParameters): PromiseLike<string | null>;
4166
}
4267

4368
export abstract class BrandingExtensionsBase implements ProvideBrandingExtensions {
4469
public getAppTitle(context: AppTitleContext): string | null {
4570
return null;
4671
}
72+
public async getFaviconSrc(content?: number | string, opts?: GetFaviconParameters): Promise<string | null> {
73+
return null;
74+
}
4775
}

0 commit comments

Comments
 (0)