1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Plugins: Add support for joplin.shouldUseDarkColors API

This commit is contained in:
Laurent Cozic
2025-02-25 15:33:44 +00:00
parent 50a1b184fd
commit fe67a44285

View File

@@ -14,6 +14,9 @@ import JoplinClipboard from './JoplinClipboard';
import JoplinWindow from './JoplinWindow';
import BasePlatformImplementation from '../BasePlatformImplementation';
import JoplinImaging from './JoplinImaging';
import { themeStyle } from '../../../theme';
import Setting from '../../../models/Setting';
import { ThemeAppearance } from '../../../themes/type';
/**
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
@@ -137,4 +140,12 @@ export default class Joplin {
return this.implementation_.versionInfo;
}
/**
* Tells whether the current theme is a dark one or not.
*/
public async shouldUseDarkColors() {
const theme = themeStyle(Setting.value('theme'));
return theme.appearance === ThemeAppearance.Dark;
}
}