CustomCSS
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:18
Extends
Section titled “Extends”Properties
Section titled “Properties”_children
Section titled “_children”_children:
Component
[]
Defined in: src/obsidian/augmentations/Components/Component.d.ts:13
Child Components attached to current component, will be unloaded on unloading parent component.
Inherited from
Section titled “Inherited from”_events
Section titled “_events”_events:
EventRef
[]
Defined in: src/obsidian/augmentations/Components/Component.d.ts:20
Events that are attached to the current component, will be detached on unloading parent component.
Inherited from
Section titled “Inherited from”_loaded
Section titled “_loaded”_loaded:
boolean
Defined in: src/obsidian/augmentations/Components/Component.d.ts:27
Whether the component and its children are loaded.
Inherited from
Section titled “Inherited from”app:
App
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:22
Reference to App.
csscache
Section titled “csscache”csscache:
Map
<string
,string
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:27
Cache of CSS snippet filepath (relative to vault root) to CSS snippet contents.
enabledSnippets
Section titled “enabledSnippets”enabledSnippets:
Set
<string
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:32
Set of enabled snippet, given by filenames.
extraStyleEls
Section titled “extraStyleEls”extraStyleEls:
HTMLStyleElement
[]
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:37
Contains references to Style elements containing custom CSS snippets.
oldThemes
Section titled “oldThemes”oldThemes:
string
[]
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:42
List of theme names not fully updated to post v1.0.0 theme guidelines.
queue:
PromisedQueue
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:45
requestLoadSnippets
Section titled “requestLoadSnippets”requestLoadSnippets:
Debouncer
<[],void
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:48
requestLoadTheme
Section titled “requestLoadTheme”requestLoadTheme:
Debouncer
<[],void
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:51
requestReadThemes
Section titled “requestReadThemes”requestReadThemes:
Debouncer
<[],void
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:54
snippets
Section titled “snippets”snippets:
string
[]
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:59
List of snippets detected by Obsidian, given by their filenames.
theme:
string
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:66
Currently active theme, given by its name.
themes
Section titled “themes”themes:
CustomCSSThemesRecord
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:71
Mapping of theme names to their manifest.
updates
Section titled “updates”updates:
CustomCSSUpdatesRecord
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:74
Methods
Section titled “Methods”addChild()
Section titled “addChild()”Call Signature
Section titled “Call Signature”addChild<
T
>(component
):T
Defined in: obsidian.d.ts:911
Adds a child component, loading it if this component is loaded
Type Parameters
Section titled “Type Parameters”T
extends Component
Parameters
Section titled “Parameters”component
Section titled “component”T
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”addChild<
T
>(component
):T
Defined in: src/obsidian/augmentations/Components/Component.d.ts:41
Adds a child component, loading it if this component is loaded.
Type Parameters
Section titled “Type Parameters”T
extends Component
The type of the component to add.
Parameters
Section titled “Parameters”component
Section titled “component”T
The component to add.
Returns
Section titled “Returns”T
The added component.
Example
Section titled “Example”component.addChild(childComponent);
Inherited from
Section titled “Inherited from”boundRaw()
Section titled “boundRaw()”boundRaw(
themeName
):void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:77
Parameters
Section titled “Parameters”themeName
Section titled “themeName”string
Returns
Section titled “Returns”void
checkForUpdate()
Section titled “checkForUpdate()”checkForUpdate(
themeName
):void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:84
Check whether a specific theme can be updated.
Parameters
Section titled “Parameters”themeName
Section titled “themeName”string
Name of the theme to check.
Returns
Section titled “Returns”void
checkForUpdates()
Section titled “checkForUpdates()”checkForUpdates():
void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:89
Check all themes for updates.
Returns
Section titled “Returns”void
disableTranslucency()
Section titled “disableTranslucency()”disableTranslucency():
void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:94
Disable translucency of application background.
Returns
Section titled “Returns”void
downloadLegacyTheme()
Section titled “downloadLegacyTheme()”downloadLegacyTheme(
options
):Promise
<string
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:101
Fetch legacy theme CSS using the pre-v1.0.0 theme download pipeline.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise
<string
>
String obsidian.css contents.
enableTranslucency()
Section titled “enableTranslucency()”enableTranslucency():
void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:106
Enable translucency of application background.
Returns
Section titled “Returns”void
getManifest()
Section titled “getManifest()”getManifest(
repoUrl
):Promise
<ThemeManifest
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:113
Fetch a theme’s manifest using repository URL.
Parameters
Section titled “Parameters”repoUrl
Section titled “repoUrl”string
Returns
Section titled “Returns”getSnippetPath()
Section titled “getSnippetPath()”getSnippetPath(
snippetName
):string
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:120
Convert snippet name to its corresponding filepath (relative to vault root).
Parameters
Section titled “Parameters”snippetName
Section titled “snippetName”string
Returns
Section titled “Returns”string
String .obsidian/snippets/${snippetName}.css
.
getSnippetsFolder()
Section titled “getSnippetsFolder()”getSnippetsFolder():
string
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:125
Returns the folder path where snippets are stored (relative to vault root).
Returns
Section titled “Returns”string
getThemeFolder()
Section titled “getThemeFolder()”getThemeFolder():
string
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:130
Returns the folder path where themes are stored (relative to vault root).
Returns
Section titled “Returns”string
getThemePath()
Section titled “getThemePath()”getThemePath(
themeName
):string
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:137
Convert theme name to its corresponding filepath (relative to vault root).
Parameters
Section titled “Parameters”themeName
Section titled “themeName”string
Returns
Section titled “Returns”string
String .obsidian/themes/${themeName}/theme.css
.
hasUpdates()
Section titled “hasUpdates()”hasUpdates():
boolean
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:142
Returns whether there are themes that can be updated.
Returns
Section titled “Returns”boolean
installLegacyTheme()
Section titled “installLegacyTheme()”installLegacyTheme(
options
):Promise
<void
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:150
Install a legacy theme using the pre-v1.0.0 theme download pipeline
Will create a corresponding.
dummy manifest for the theme.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Promise
<void
>
installTheme()
Section titled “installTheme()”installTheme(
options
,version
):Promise
<void
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:155
Install a theme using the regular theme download pipeline.
Parameters
Section titled “Parameters”options
Section titled “options”version
Section titled “version”string
Returns
Section titled “Returns”Promise
<void
>
isThemeInstalled()
Section titled “isThemeInstalled()”isThemeInstalled(
themeName
):boolean
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:160
Check whether a specific theme is installed by theme name.
Parameters
Section titled “Parameters”themeName
Section titled “themeName”string
Returns
Section titled “Returns”boolean
load()
Section titled “load()”Call Signature
Section titled “Call Signature”load():
void
Defined in: obsidian.d.ts:889
Load this component and its children
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”load():
void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:48
Load this component and its children.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”loadCss()
Section titled “loadCss()”loadCss(
arg1
):Promise
<unknown
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:163
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Promise
<unknown
>
loadData()
Section titled “loadData()”loadData():
unknown
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:166
Returns
Section titled “Returns”unknown
loadSnippets()
Section titled “loadSnippets()”loadSnippets():
unknown
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:169
Returns
Section titled “Returns”unknown
loadTheme()
Section titled “loadTheme()”loadTheme(
arg1
):unknown
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:172
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”unknown
onload()
Section titled “onload()”onload():
void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:175
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”onRaw()
Section titled “onRaw()”onRaw(
themeName
):void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:178
Parameters
Section titled “Parameters”themeName
Section titled “themeName”string
Returns
Section titled “Returns”void
onunload()
Section titled “onunload()”onunload():
void
Defined in: obsidian.d.ts:906
Override this to unload your component
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”readSnippets()
Section titled “readSnippets()”readSnippets():
void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:181
Returns
Section titled “Returns”void
readThemes()
Section titled “readThemes()”readThemes():
void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:184
Returns
Section titled “Returns”void
register()
Section titled “register()”Call Signature
Section titled “Call Signature”register(
cb
):void
Defined in: obsidian.d.ts:921
Registers a callback to be called when unloading
Parameters
Section titled “Parameters”() => any
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”register(
cb
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:78
Registers a callback to be called when unloading.
Parameters
Section titled “Parameters”() => any
The callback to be called when unloading.
Returns
Section titled “Returns”void
Example
Section titled “Example”component.register(() => { console.log('MyComponent unloaded');});
Inherited from
Section titled “Inherited from”registerDomEvent()
Section titled “registerDomEvent()”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: obsidian.d.ts:931
Registers an DOM event to be detached when unloading
Type Parameters
Section titled “Type Parameters”K
extends keyof WindowEventMap
Parameters
Section titled “Parameters”K
callback
Section titled “callback”(this
, ev
) => any
options?
Section titled “options?”boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: obsidian.d.ts:936
Registers an DOM event to be detached when unloading
Type Parameters
Section titled “Type Parameters”K
extends keyof DocumentEventMap
Parameters
Section titled “Parameters”K
callback
Section titled “callback”(this
, ev
) => any
options?
Section titled “options?”boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: obsidian.d.ts:941
Registers an DOM event to be detached when unloading
Type Parameters
Section titled “Type Parameters”K
extends keyof HTMLElementEventMap
Parameters
Section titled “Parameters”K
callback
Section titled “callback”(this
, ev
) => any
options?
Section titled “options?”boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:96
Registers an DOM event to be detached when unloading.
Type Parameters
Section titled “Type Parameters”K
extends keyof DocumentEventMap
The type of the event to register.
Parameters
Section titled “Parameters”The element to register the event on.
K
The type of the event to register.
callback
Section titled “callback”(this
, ev
) => any
The callback to be called when the event is triggered.
options?
Section titled “options?”The options for the event.
boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerDomEvent(document, 'click', () => { console.log('Document clicked');});
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:119
Registers an DOM event to be detached when unloading.
Type Parameters
Section titled “Type Parameters”K
extends keyof HTMLElementEventMap
The type of the event to register.
Parameters
Section titled “Parameters”The element to register the event on.
K
The type of the event to register.
callback
Section titled “callback”(this
, ev
) => any
The callback to be called when the event is triggered.
options?
Section titled “options?”The options for the event.
boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerDomEvent(document.body, 'click', () => { console.log('Body clicked');});
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerDomEvent<
K
>(el
,type
,callback
,options?
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:142
Registers an DOM event to be detached when unloading.
Type Parameters
Section titled “Type Parameters”K
extends keyof WindowEventMap
The type of the event to register.
Parameters
Section titled “Parameters”The element to register the event on.
K
The type of the event to register.
callback
Section titled “callback”(this
, ev
) => any
The callback to be called when the event is triggered.
options?
Section titled “options?”The options for the event.
boolean
| AddEventListenerOptions
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerDomEvent(window, 'click', () => { console.log('Window clicked');});
Inherited from
Section titled “Inherited from”registerEvent()
Section titled “registerEvent()”Call Signature
Section titled “Call Signature”registerEvent(
eventRef
):void
Defined in: obsidian.d.ts:926
Registers an event to be detached when unloading
Parameters
Section titled “Parameters”eventRef
Section titled “eventRef”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerEvent(
eventRef
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:159
Registers an event to be detached when unloading.
Parameters
Section titled “Parameters”eventRef
Section titled “eventRef”The event to be registered.
Returns
Section titled “Returns”void
Example
Section titled “Example”component.registerEvent(eventRef);
Inherited from
Section titled “Inherited from”registerInterval()
Section titled “registerInterval()”Call Signature
Section titled “Call Signature”registerInterval(
id
):number
Defined in: obsidian.d.ts:948
Registers an interval (from setInterval) to be cancelled when unloading Use setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”registerInterval(
id
):number
Defined in: src/obsidian/augmentations/Components/Component.d.ts:175
Registers an interval (from setInterval) to be cancelled when unloading. Use setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
Parameters
Section titled “Parameters”number
The id of the interval to register.
Returns
Section titled “Returns”number
The id of the interval.
Example
Section titled “Example”component.registerInterval(window.setInterval(() => { console.log('Interval');}, 1000));
Inherited from
Section titled “Inherited from”registerScopeEvent()
Section titled “registerScopeEvent()”registerScopeEvent(
keymapEventHandler
):void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:181
Parameters
Section titled “Parameters”keymapEventHandler
Section titled “keymapEventHandler”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”removeChild()
Section titled “removeChild()”Call Signature
Section titled “Call Signature”removeChild<
T
>(component
):T
Defined in: obsidian.d.ts:916
Removes a child component, unloading it
Type Parameters
Section titled “Type Parameters”T
extends Component
Parameters
Section titled “Parameters”component
Section titled “component”T
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”removeChild<
T
>(component
):T
Defined in: src/obsidian/augmentations/Components/Component.d.ts:195
Removes a child component, unloading it.
Type Parameters
Section titled “Type Parameters”T
extends Component
The type of the component to remove.
Parameters
Section titled “Parameters”component
Section titled “component”T
The component to remove.
Returns
Section titled “Returns”T
The removed component.
Example
Section titled “Example”component.removeChild(childComponent);
Inherited from
Section titled “Inherited from”removeTheme()
Section titled “removeTheme()”removeTheme(
themeName
):Promise
<void
>
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:189
Remove a theme by theme name.
Parameters
Section titled “Parameters”themeName
Section titled “themeName”string
Returns
Section titled “Returns”Promise
<void
>
setCssEnabledStatus()
Section titled “setCssEnabledStatus()”setCssEnabledStatus(
snippetName
,enabled
):void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:194
Set the activation status of a snippet by snippet name.
Parameters
Section titled “Parameters”snippetName
Section titled “snippetName”string
enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”void
setTheme()
Section titled “setTheme()”setTheme(
themeName
):void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:199
Set the active theme by theme name.
Parameters
Section titled “Parameters”themeName
Section titled “themeName”string
Returns
Section titled “Returns”void
setTranslucency()
Section titled “setTranslucency()”setTranslucency(
translucency
):void
Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:204
Set the translucency of application background.
Parameters
Section titled “Parameters”translucency
Section titled “translucency”boolean
Returns
Section titled “Returns”void
unload()
Section titled “unload()”Call Signature
Section titled “Call Signature”unload():
void
Defined in: obsidian.d.ts:900
Unload this component and its children
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”unload():
void
Defined in: src/obsidian/augmentations/Components/Component.d.ts:211
Override this to unload your component.
Returns
Section titled “Returns”void
Example
Section titled “Example”class MyComponent extends Component { public override onunload(): void { console.log('MyComponent unloaded'); }}