🌓 Auto Theme - 智能主题切换插件

智能切换VS Code主题的扩展工具,基于地理位置、日出日落时间和实时天气自动适配最佳编辑环境。

✨ 核心功能
🌗 智能主题切换
- 🕒 基于本地时间的自动切换
- 🌍 地理位置感知(IP定位+GPS备用)
- 🌅 动态计算日出日落时间
- ⚡ 智能调度系统(最优性能)
🌤️ 环境感知
🛠️ 高级配置
"autoTheme.mode": "auto", // [auto|manual]
"autoTheme.dayTheme": "Default Light+",
"autoTheme.nightTheme": "Default Dark+",
"autoTheme.manualLocation": { "lat": 39.9042, "lng": 116.4074 }
🚀 快速开始
安装方式
应用市场安装
- VS Code扩展商店搜索
Auto Theme
- 点击安装按钮
手动安装
git clone https://github.com/yourname/auto-theme.git
cd auto-theme
vsce package
code --install-extension auto-theme-0.1.0.vsix
使用指南
- 打开命令面板 (
Ctrl+Shift+P )
- 运行
Auto Theme: Enable 启用插件
- 点击状态栏图标打开控制面板
- 选择工作模式:
- 🌞 白天模式:使用浅色主题
- 🌙 夜间模式:使用深色主题
- 🤖 自动模式:根据地理位置自动切换
⚙️ 配置参考
配置项 |
类型 |
默认值 |
说明 |
autoTheme.precision |
number |
300 |
检测间隔(秒) |
autoTheme.weatherUnit |
string |
"metric" |
温度单位(metric/imperial) |
autoTheme.enableLunar |
boolean |
true |
是否显示农历 |
autoTheme.alertLevel |
string |
"notification" |
错误提示方式(notification/toast/none) |
🌍 定位服务架构
graph TD
A[用户请求] --> B{定位服务}
B -->|主服务| C[ipapi.co]
B -->|备用服务| D[ip.sb]
C --> E{数据校验}
D --> E
E -->|有效数据| F[更新配置]
E -->|无效数据| G[使用默认坐标]
🛠️ 开发指南
环境要求
- Node.js >= 16.x
- VS Code API >= 1.75
- TypeScript >= 4.7
构建步骤
npm install
npm run compile
npm run watch # 开发模式
❓ 常见问题
定位服务失效?
检查网络连接
尝试手动设置坐标:
"autoTheme.manualLocation": {
"lat": 39.9042,
"lng": 116.4074
}
主题未生效?
确认主题名称与已安装主题完全一致
检查控制台日志:
code --logExtensionHost
📄 License
MIT License © 2024 [Vogadero]
| |