feat: 初始化 Halo 暗色模式插件
- Halo Plugin 后端(Java/Gradle),含 DarkModePlugin 主类和测试 - Vue 3 + TypeScript 前端 UI,包含主题切换组件和设置页面 - 暗色模式 CSS 变量和覆盖样式(布局/编辑器/表单/滚动条等) - 设计文档和调查文档 - Halo 插件/主题开发 Agent Skills Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package run.halo.darkmode;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import run.halo.app.plugin.BasePlugin;
|
||||
import run.halo.app.plugin.PluginContext;
|
||||
|
||||
/**
|
||||
* <p>Plugin main class to manage the lifecycle of the plugin.</p>
|
||||
* <p>This class must be public and have a public constructor.</p>
|
||||
* <p>Only one main class extending {@link BasePlugin} is allowed per plugin.</p>
|
||||
*
|
||||
* @author LHY
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
public class DarkModePlugin extends BasePlugin {
|
||||
|
||||
public DarkModePlugin(PluginContext pluginContext) {
|
||||
super(pluginContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
System.out.println("插件启动成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
System.out.println("插件停止!");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1,22 @@
|
||||
# Refer https://docs.halo.run/developer-guide/plugin/basics/manifest
|
||||
|
||||
apiVersion: plugin.halo.run/v1alpha1
|
||||
kind: Plugin
|
||||
metadata:
|
||||
# The name defines how the plugin is invoked, A unique name
|
||||
name: dark-mode
|
||||
spec:
|
||||
enabled: true
|
||||
requires: ">=2.25.0"
|
||||
author:
|
||||
name: LHY
|
||||
website: https://github.com/LHY
|
||||
logo: logo.png
|
||||
homepage: https://github.com/LHY/dark-mode#readme
|
||||
repo: https://github.com/LHY/dark-mode
|
||||
issues: https://github.com/LHY/dark-mode/issues
|
||||
displayName: "深色模式"
|
||||
description: "为 Halo 后台管理面板提供深色/浅色模式切换,支持跟随系统、手动切换和偏好记忆"
|
||||
license:
|
||||
- name: "GPL-3.0"
|
||||
url: "https://github.com/LHY/dark-mode/blob/main/LICENSE"
|
||||
@@ -0,0 +1,24 @@
|
||||
package run.halo.darkmode;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import run.halo.app.plugin.PluginContext;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class DarkModePluginTest {
|
||||
|
||||
@Mock
|
||||
PluginContext context;
|
||||
|
||||
@InjectMocks
|
||||
DarkModePlugin plugin;
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
plugin.start();
|
||||
plugin.stop();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user