Skip to content

CustomCSS

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:13

Extends

Properties

_children

_children: Component[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:9

Child Components attached to current component, will be unloaded on unloading parent component

Inherited from

Component._children


_events

_events: EventRef[]

Defined in: src/obsidian/augmentations/Components/Component.d.ts:13

Events that are attached to the current component, will be detached on unloading parent component

Inherited from

Component._events


_loaded

_loaded: boolean

Defined in: src/obsidian/augmentations/Components/Component.d.ts:17

Whether the component and its children are loaded

Inherited from

Component._loaded


app

app: App

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:17

Reference to App


enabledSnippets

enabledSnippets: Set<string>

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:23

Set of enabled snippet, given by filenames


oldThemes

oldThemes: string[]

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:32

List of theme names not fully updated to post v1.0.0 theme guidelines


snippets

snippets: string[]

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:44

List of snippets detected by Obsidian, given by their filenames


theme

theme: string

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:50

Currently active theme, given by its name

themes

themes: CustomCSSThemesRecord

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:54

Mapping of theme names to their manifest

Methods

addChild()

addChild<T>(component): T

Defined in: obsidian.d.ts:887

Adds a child component, loading it if this component is loaded

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Inherited from

Component.addChild


checkForUpdate()

checkForUpdate(themeName): void

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:65

Check whether a specific theme can be updated

Parameters

themeName

string

Name of the theme to check

Returns

void


checkForUpdates()

checkForUpdates(): void

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:69

Check all themes for updates

Returns

void


disableTranslucency()

disableTranslucency(): void

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:73

Disable translucency of application background

Returns

void


downloadLegacyTheme()

downloadLegacyTheme(arg): Promise<string>

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:79

Fetch legacy theme CSS using the pre-v1.0.0 theme download pipeline

Parameters

arg
repo

string

Returns

Promise<string>

String obsidian.css contents


enableTranslucency()

enableTranslucency(): void

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:83

Enable translucency of application background

Returns

void


getManifest()

getManifest(repoUrl): Promise<ThemeManifest>

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:89

Fetch a theme’s manifest using repository URL

Parameters

repoUrl

string

Returns

Promise<ThemeManifest>

getSnippetPath()

getSnippetPath(snippetName): string

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:95

Convert snippet name to its corresponding filepath (relative to vault root)

Parameters

snippetName

string

Returns

string

String .obsidian/snippets/${snippetName}.css


getSnippetsFolder()

getSnippetsFolder(): string

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:99

Returns the folder path where snippets are stored (relative to vault root)

Returns

string


getThemeFolder()

getThemeFolder(): string

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:103

Returns the folder path where themes are stored (relative to vault root)

Returns

string


getThemePath()

getThemePath(themeName): string

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:109

Convert theme name to its corresponding filepath (relative to vault root)

Parameters

themeName

string

Returns

string

String .obsidian/themes/${themeName}/theme.css


hasUpdates()

hasUpdates(): boolean

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:113

Returns whether there are themes that can be updated

Returns

boolean


installLegacyTheme()

installLegacyTheme(arg): Promise<void>

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:120

Install a legacy theme using the pre-v1.0.0 theme download pipeline
Will create a corresponding dummy manifest for the theme

Parameters

arg
author

string

name

string

repo

string

Returns

Promise<void>

installTheme()

installTheme(arg, version): Promise<void>

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:124

Install a theme using the regular theme download pipeline

Parameters

arg
author

string

name

string

repo

string

version

string

Returns

Promise<void>


isThemeInstalled()

isThemeInstalled(themeName): boolean

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:128

Check whether a specific theme is installed by theme name

Parameters

themeName

string

Returns

boolean


load()

load(): void

Defined in: obsidian.d.ts:865

Load this component and its children

Returns

void

Inherited from

Component.load


loadCss()

loadCss(arg1): Promise<unknown>

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:129

Parameters

arg1

unknown

Returns

Promise<unknown>


loadData()

loadData(): unknown

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:130

Returns

unknown


loadSnippets()

loadSnippets(): unknown

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:131

Returns

unknown


loadTheme()

loadTheme(arg1): unknown

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:132

Parameters

arg1

unknown

Returns

unknown


onunload()

onunload(): void

Defined in: obsidian.d.ts:882

Override this to unload your component

Returns

void

Inherited from

Component.onunload


register()

register(cb): void

Defined in: obsidian.d.ts:897

Registers a callback to be called when unloading

Parameters

cb

() => any

Returns

void

Inherited from

Component.register


registerDomEvent()

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:907

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof WindowEventMap

Parameters
el

Window

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:912

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof DocumentEventMap

Parameters
el

Document

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.registerDomEvent

Call Signature

registerDomEvent<K>(el, type, callback, options?): void

Defined in: obsidian.d.ts:917

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof HTMLElementEventMap

Parameters
el

HTMLElement

type

K

callback

(this, ev) => any

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

Component.registerDomEvent


registerEvent()

registerEvent(eventRef): void

Defined in: obsidian.d.ts:902

Registers an event to be detached when unloading

Parameters

eventRef

EventRef

Returns

void

Inherited from

Component.registerEvent


registerInterval()

registerInterval(id): number

Defined in: obsidian.d.ts:924

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

id

number

Returns

number

Inherited from

Component.registerInterval


registerScopeEvent()

registerScopeEvent(keymapEventHandler): void

Defined in: src/obsidian/augmentations/Components/Component.d.ts:19

Parameters

keymapEventHandler

KeymapEventHandler

Returns

void

Inherited from

Component.registerScopeEvent


removeChild()

removeChild<T>(component): T

Defined in: obsidian.d.ts:892

Removes a child component, unloading it

Type Parameters

T extends Component

Parameters

component

T

Returns

T

Inherited from

Component.removeChild


removeTheme()

removeTheme(themeName): Promise<void>

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:144

Remove a theme by theme name

Parameters

themeName

string

Returns

Promise<void>


setCssEnabledStatus()

setCssEnabledStatus(snippetName, enabled): void

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:148

Set the activation status of a snippet by snippet name

Parameters

snippetName

string

enabled

boolean

Returns

void


setTheme()

setTheme(themeName): void

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:152

Set the active theme by theme name

Parameters

themeName

string

Returns

void


setTranslucency()

setTranslucency(translucency): void

Defined in: src/obsidian/internals/CustomCSS/CustomCSS.d.ts:156

Set the translucency of application background

Parameters

translucency

boolean

Returns

void


unload()

unload(): void

Defined in: obsidian.d.ts:876

Unload this component and its children

Returns

void

Inherited from

Component.unload