nx: set theme color

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-05-07 21:06:30 -07:00
parent 3e88e2cab4
commit 0476703567
2 changed files with 12 additions and 0 deletions

View File

@ -226,6 +226,12 @@ export default defineComponent({
root.style.setProperty('--color-primary-select-light', `${colorPrimary}40`);
root.style.setProperty('--plyr-color-main', colorPrimary);
// Set theme color for native part
nativex.setThemeColor?.(
getComputedStyle(document.body).getPropertyValue('--color-main-background'),
document.body.hasAttribute('data-theme-dark')
);
// Register sidebar metadata tab
globalThis.OCA?.Files?.Sidebar?.registerTab(
new globalThis.OCA.Files.Sidebar.Tab({

View File

@ -10,6 +10,7 @@ type NativePromise<T> = (call: string, arg: T) => void;
*/
export type NativeX = {
isNative: () => boolean;
setThemeColor: (color: string, isDark: boolean) => void;
getLocalDays: NativePromise<string>;
getLocalByDayId: NativePromise<string>;
getJpeg: NativePromise<string>;
@ -80,6 +81,11 @@ globalThis.nativexr = (call: string, resolve?: string, reject?: string) => {
*/
export const has = () => !!nativex;
/**
* Change the theme color of the app.
*/
export const setThemeColor: typeof nativex.setThemeColor = nativex?.setThemeColor.bind(nativex);
/**
* Gets the local days array.
*