Skip to content

Commit 798f349

Browse files
committed
fix theme again because i didnt test it
1 parent d02ca35 commit 798f349

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
)
3131

3232
const (
33-
version = "v0.0.13"
33+
version = "v0.0.14"
3434
)
3535

3636
var (

web/static/js/vimbin.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
document.addEventListener("DOMContentLoaded", function () {
22
// Function to get the preferred theme (dark, light, or system default)
33
function getPreferredTheme() {
4-
return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches
5-
? "catppuccin"
6-
: "default";
4+
const prefersDarkMode = window.matchMedia?.(
5+
"(prefers-color-scheme: dark)",
6+
)?.matches;
7+
8+
// If theme is set to "dark" or "auto" and the user prefers dark mode, return "catppuccino"
9+
if ((theme === "auto" || theme === "dark") && prefersDarkMode) {
10+
return "catppuccin";
11+
}
12+
13+
// For any other case, return "light"
14+
return "light";
715
}
816

917
// Function to set the theme based on the initial color scheme or the 'theme' variable
1018
function setThemeBasedOnColorScheme() {
11-
const preferredTheme = theme || getPreferredTheme();
19+
const preferredTheme = getPreferredTheme();
1220
console.log(`Setting theme to '${preferredTheme}'`);
13-
1421
editor.setOption("theme", preferredTheme);
1522
}
16-
1723
// Function to update Vim mode display
1824
function updateVimMode(vimEvent, vimModeElement) {
1925
const { mode, subMode } = vimEvent;

0 commit comments

Comments
 (0)