Skip to content

Commit

Permalink
fix theme again because i didnt test it
Browse files Browse the repository at this point in the history
  • Loading branch information
gi8lino committed Dec 20, 2023
1 parent d02ca35 commit 798f349
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

const (
version = "v0.0.13"
version = "v0.0.14"
)

var (
Expand Down
18 changes: 12 additions & 6 deletions web/static/js/vimbin.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
document.addEventListener("DOMContentLoaded", function () {
// Function to get the preferred theme (dark, light, or system default)
function getPreferredTheme() {
return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches
? "catppuccin"
: "default";
const prefersDarkMode = window.matchMedia?.(
"(prefers-color-scheme: dark)",
)?.matches;

// If theme is set to "dark" or "auto" and the user prefers dark mode, return "catppuccino"
if ((theme === "auto" || theme === "dark") && prefersDarkMode) {
return "catppuccin";
}

// For any other case, return "light"
return "light";
}

// Function to set the theme based on the initial color scheme or the 'theme' variable
function setThemeBasedOnColorScheme() {
const preferredTheme = theme || getPreferredTheme();
const preferredTheme = getPreferredTheme();
console.log(`Setting theme to '${preferredTheme}'`);

editor.setOption("theme", preferredTheme);
}

// Function to update Vim mode display
function updateVimMode(vimEvent, vimModeElement) {
const { mode, subMode } = vimEvent;
Expand Down

0 comments on commit 798f349

Please sign in to comment.