mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
23 lines
848 B
TypeScript
23 lines
848 B
TypeScript
import { PluginMetadata } from '@/plugins/plugin'
|
|
import { KeyBindingAction } from 'registry/lib/components/utils/keymap/bindings'
|
|
|
|
export const plugin: PluginMetadata = {
|
|
name: 'keymap.actions.darkMode',
|
|
displayName: '快捷键扩展 - 夜间模式',
|
|
description: '在快捷键的动作列表里添加一个 "夜间模式", 可以通过快捷键切换夜间模式',
|
|
setup: ({ addData, coreApis: { settings } }) => {
|
|
addData('keymap.actions', (actions: Record<string, KeyBindingAction>) => {
|
|
actions.darkMode = {
|
|
displayName: '夜间模式',
|
|
run: () => {
|
|
const darkMode = settings.getComponentSettings('darkMode')
|
|
darkMode.enabled = !darkMode.enabled
|
|
},
|
|
}
|
|
})
|
|
addData('keymap.presets', (presetBase: Record<string, string>) => {
|
|
presetBase.darkMode = ''
|
|
})
|
|
},
|
|
}
|