Now a check if variant has the mode user is already on.
Temp writes to config file for the scheme change to register in config file and settingswindow.
What does this fix
Variant check will not error out the colorscheme preset selection in cli if user is not on the same mode as user. Say user is on dark mode, but wants to select a preset that only has light mode, now does not error.
Temp write so that the colorscheme change shows correctly in settingswindow.
Caveats
QML file watcher seems to read mid write, which is the reason for a temp write. Without a temp write, you get a JSON parse error. It does not affect usability, but not a pretty look. I am sure this can be resolved on the qml side as the current solution is a bit ugly.
In the future, an enhancement would be that a preset scheme can be better integrated with the light/dark mode scheduler. I will create an issue on this and propose two suggestions (at least what I think is possible). Now at #125.
Closes #95.
## Changes
- Now a check if variant has the mode user is already on.
- Temp writes to config file for the scheme change to register in config file and settingswindow.
## What does this fix
- Variant check will not error out the colorscheme preset selection in cli if user is not on the same mode as user. Say user is on dark mode, but wants to select a preset that only has light mode, now does not error.
- Temp write so that the colorscheme change shows correctly in settingswindow.
## Caveats
- QML file watcher seems to read mid write, which is the reason for a temp write. Without a temp write, you get a JSON parse error. It does not affect usability, but not a pretty look. I am sure this can be resolved on the qml side as the current solution is a bit ugly.
- In the future, an enhancement would be that a preset scheme can be better integrated with the light/dark mode scheduler. I will create an issue on this and propose two suggestions (at least what I think is possible). Now at #125.
AramJonghu
added the bug label 2026-06-14 01:17:41 +02:00
AramJonghu
self-assigned this 2026-06-14 01:17:41 +02:00
Note: I found a bug where if user selects light mode in the settingswindow, but uses dark scheme preset, other UI does not follow. Would have to investigate further on this specific issue.
Note: I found a bug where if user selects light mode in the settingswindow, but uses dark scheme preset, other UI does not follow. Would have to investigate further on this specific issue.
Note: I found a bug where if user selects light mode in the settingswindow, but uses dark scheme preset, other UI does not follow. Would have to investigate further on this specific issue.
Probably has to do with how I normally call generate from QML. I usually write:
Which means the flag is explicitly set to the mode the user currently has selected. I think this should stay the way it is because even if the user doesn't enable scheduled dark mode, the toggle for dark mode should still be functional (once implemented for presets.)
> Note: I found a bug where if user selects light mode in the settingswindow, but uses dark scheme preset, other UI does not follow. Would have to investigate further on this specific issue.
Probably has to do with how I normally call `generate` from QML. I usually write:
```qml
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--mode", `${Config.general.color.mode}`]);
```
Which means the flag is explicitly set to the mode the user currently has selected. I think this should stay the way it is because even if the user doesn't enable scheduled dark mode, the toggle for dark mode should still be functional (once implemented for presets.)
I personally think we shouldn't default to something here. Raising an exception would be better if the requested scheme is not found, maybe write exception trace to log file too. This is because the condition on line 601 should never return true and if it does then it means we are calling it incorrectly from QML/CLI.
I personally think we shouldn't default to something here. Raising an exception would be better if the requested scheme is not found, maybe write exception trace to log file too. This is because the condition on line 601 should never return true and if it does then it means we are calling it incorrectly from QML/CLI.
The reason it is there is because the current implementation usually only has a single mode per colorscheme preset. rosepine:dawn only has light mode for example. The current implementation allows less friction when selecting a preset that is not aligning to the mode you are at currently.
resolved_mode can only be light or dark (I am pretty sure).
We can think of a different solution, but that would be a more complex solution that'd be more dynamic (a possible consequence of the implementation of #125). Lets say user is on rosepine:main, which is a dark preset. If user switches to light, it could dynamically understand to move to rosepine:dawn. The current implementation does not do this.
I agree with error/exception trace to log file, good idea.
The reason it is there is because the current implementation usually only has a single mode per colorscheme preset. `rosepine:dawn` only has light mode for example. The current implementation allows less friction when selecting a preset that is not aligning to the mode you are at currently.
`resolved_mode` can only be light or dark (I am pretty sure).
We can think of a different solution, but that would be a more complex solution that'd be more dynamic (a possible consequence of the implementation of #125). Lets say user is on `rosepine:main`, which is a dark preset. If user switches to light, it could dynamically understand to move to `rosepine:dawn`. The current implementation does not do this.
I agree with error/exception trace to log file, good idea.
zach marked this conversation as resolved
zach
merged commit 7cf6e5f8a5 into main2026-06-14 21:27:27 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #95.
Changes
What does this fix
Caveats
Note: I found a bug where if user selects light mode in the settingswindow, but uses dark scheme preset, other UI does not follow. Would have to investigate further on this specific issue.
Probably has to do with how I normally call
generatefrom QML. I usually write:Which means the flag is explicitly set to the mode the user currently has selected. I think this should stay the way it is because even if the user doesn't enable scheduled dark mode, the toggle for dark mode should still be functional (once implemented for presets.)
@@ -593,0 +599,4 @@(vari for vari in meta.variants if vari.id == p_variant), None)if variant and requested_mode not in variant.modes and variant.modes:resolved_mode = sorted(variant.modes)[0]I personally think we shouldn't default to something here. Raising an exception would be better if the requested scheme is not found, maybe write exception trace to log file too. This is because the condition on line 601 should never return true and if it does then it means we are calling it incorrectly from QML/CLI.
The reason it is there is because the current implementation usually only has a single mode per colorscheme preset.
rosepine:dawnonly has light mode for example. The current implementation allows less friction when selecting a preset that is not aligning to the mode you are at currently.resolved_modecan only be light or dark (I am pretty sure).We can think of a different solution, but that would be a more complex solution that'd be more dynamic (a possible consequence of the implementation of #125). Lets say user is on
rosepine:main, which is a dark preset. If user switches to light, it could dynamically understand to move torosepine:dawn. The current implementation does not do this.I agree with error/exception trace to log file, good idea.