···11-import process from 'node:process';
11+import darkMode from 'dark-mode';
22import {setTerminalProfile, setTerminalDefaultProfile} from 'terminal-profile';
33import {config} from '../config.js';
44-import {isTerminalOpen} from '../functions/index.js';
44+import {
55+ isAutomaticSwitchingEnabled,
66+ isTerminalOpen,
77+} from '../functions/index.js';
5869export async function updateProfile() {
77- if (!(await isTerminalOpen())) return;
1010+ if (!(await isAutomaticSwitchingEnabled()) || !(await isTerminalOpen())) {
1111+ return;
1212+ }
813914 if (!config.darkProfile) {
1015 throw new Error('Dark profile not set');
···1419 throw new Error('Light profile not set');
1520 }
16211717- const mode = process.env.DARKMODE === '1' ? 'dark' : 'light';
2222+ const mode = (await darkMode.isEnabled()) ? 'dark' : 'light';
1823 const profile = config[`${mode}Profile`];
19242025 await Promise.all([
+10
changelog.md
···55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7788+## [Unreleased](https://github.com/patrik-csak/terminal-profile/compare/v3.0.2...HEAD)
99+1010+### Changed
1111+1212+- **BREAKING**: `update-profile` gets appearance mode from OS instead of from `DARKMODE` environment variable
1313+814## [v3.0.2](https://github.com/patrik-csak/terminal-profile/compare/v3.0.1...v3.0.2) – 2024-02-21
9151016### Fixed
···1824- Fix broken post-install compilation step
19252026## [v3.0.0](https://github.com/patrik-csak/terminal-profile/compare/v2.1.0...v3.0.0) – 2024-02-19
2727+2828+### Changed
2929+3030+- **BREAKING**: `update-profile` gets appearance mode from `DARKMODE` environment variable instead of from OS
21312232### Removed
2333